-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
CtClass.getSuperClass() returns invalid CtTypeReference #959
Comments
The wrong declaringType of that inner class is caused by this code in // Sorry for this hack but see the test case ImportTest#testImportOfAnInnerClassInASuperClassPackage.
// JDT isn't smart enough to return me a super class available. So, I modify their AST when
// superclasses aren't in the same package and when their visibilities are "default".
List<ModifierKind> modifiers = Arrays.asList(ModifierKind.PUBLIC, ModifierKind.PROTECTED);
final TypeBinding resolvedType = typeDeclaration.superclass.resolvedType;
if ((resolvedType instanceof MemberTypeBinding || resolvedType instanceof BinaryTypeBinding)//
&& resolvedType.enclosingType() != null && typeDeclaration.enclosingType.superclass != null//
&& Collections.disjoint(modifiers, getModifiers(resolvedType.enclosingType().modifiers))) {
typeDeclaration.superclass.resolvedType = jdtTreeBuilder.new SpoonReferenceBinding(typeDeclaration.superclass.resolvedType.sourceName(),
(ReferenceBinding) typeDeclaration.enclosingType.superclass.resolvedType);
} @GerardPaligot please have a look. As author you can fix it probably the fastest. Thank You! @monperrus By the way, how do you manage assignment of issues to contributors? May be somebody is already fixing it and I was just wasting my time ;-) |
I don't assign anything. If somebody starts working on an issue, she/he can simply drop a comment on it to let the others know. |
I don't know how to fix this. |
The current behavior is correct, see #971 |
The
spoon.test.imports.ImportTest.testSpoonWithImports
fails with PR #913, because it now callsCtTypeReference.getActualClass()
on invalidCtTypeReference
to child classwhich has wrong qualified name
I will provide PR with simplified failing test.
The text was updated successfully, but these errors were encountered: