-
-
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
review: Fix issue with isOverriding #1407 #1411
review: Fix issue with isOverriding #1407 #1411
Conversation
There were two problems
|
There is another problem ... I have added test GenericsTest#testGetExecDeclarationOfEnumSetOf <E extends Enum> EnumSet#of(E) has different depth of boundingTypes in their CtTypeParameterReference ... Please have a look at this problem. I have no idea how to solve it... |
…dd a new convention in ReferenceBuilder to only check 2 levels in case of reflexive type parameter like E extends Enum<E>: it will only get E -> Enum -> E.
I agree, I changed the convention to solve problems like However to fix your test I also had to change the |
if (typeRefAdapted instanceof CtTypeParameterReference) { | ||
return adaptTypeParameterReferenceBoundingType((CtTypeParameterReference) typeRefAdapted, typeParamRef.getBoundingType()); | ||
} | ||
//Do not adapt bounding type of TypeParameterReference. That bounding type is already adapted as part of typeParamRef adaptation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code
it's ok for you @pvojtechovsky ? |
I will check it in the evening |
@@ -145,7 +146,16 @@ public boolean isConstructor() { | |||
@SuppressWarnings("unchecked") | |||
public CtExecutable<T> getDeclaration() { | |||
final CtTypeReference<?> typeRef = getDeclaringType(); | |||
return typeRef == null ? null : getCtExecutable(typeRef.getDeclaration()); | |||
if (typeRef == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a test typeRef.getDeclaration() == null
(not in source path)
|
||
CtInvocation invocation = ctClass.getMethodsByName("m").get(0).getBody().getStatement(0); | ||
CtExecutable<?> decl = invocation.getExecutable().getDeclaration(); | ||
assertNotNull(decl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert should be null (getDeclaration without the source for java.util). Add a new assert with getExecutableDeclaration
assertTrue(ctc.isOverriding(methods.get(0), methodsItf.get(0))); | ||
assertTrue(ctc.isSubSignature(methods.get(0), methodsItf.get(0))); | ||
|
||
// assertTrue(ctc.isSameSignature(methods.get(0), methodsItf.get(0))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented code
It is mainly Simon's work. It should be merged under his name. |
thanks! |
This PR is based on #1408 and should fix the problem of #1407.