-
-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CtType#getAllMethods contract seems not respected #1618
Comments
The documentation is wrong.
(the behavior has been changed with the introduction of shadow classes some time ago)
|
Ok, and do we agree that for a given class and its associated CtClass we should have the following contract: MyClass.class.getMethods().length == MyCtClass.getAllMethods().size() ? See: https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getMethods() |
No, because we have the methods of objects
MyCtClass.getAllMethods().size() == MyClass.class.getMethods().length + Object.methods.size
|
Actually getMethods() also return Object method. The main difference is |
Fixed in #1644 |
Looking on
CtType#getAllMethods
we have the following comment (see:spoon/src/main/java/spoon/reflect/declaration/CtType.java
Line 211 in 40e15b2
However when looking on the test
CtTypeInformationTest#testGetSuperclass
we explicitely try to obtain methods from ObjectSee:
spoon/src/test/java/spoon/reflect/declaration/CtTypeInformationTest.java
Line 139 in 40e15b2
So either the contract is wrongly defined, or the implementation is wrong.
The text was updated successfully, but these errors were encountered: