-
Notifications
You must be signed in to change notification settings - Fork 193
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
Auto Complete Error #315
Comments
Can you give a bit more skeleton of your example? Is UtilitiesFacade an interface, final class, abstract class, or other? How does it set the references to the other classes. For the other classes that are included, do any have static initializers or anything else like @TyoeChecked or @CompileStatic?
The error comes when types are being resolved. I am getting the feeling that it is unable to resolve something in your wider classpath. Content Assist does a lot of lookups against your classpath, so it tends to run into issues you may not usually hit because you are not opening and editing many of the files in your project.
The specific exception you are getting is coming from the call to syntheticMethods() in the middle of this block (from JDTClassNode.initializeMembers()). syntheticMethods throws an exception if the binding answers false to isPrototype().
```groovy
if (jdtBinding instanceof SourceTypeBinding) {
SourceTypeBinding jdtSourceTypeBinding = (SourceTypeBinding) jdtBinding;
ClassScope classScope = jdtSourceTypeBinding.scope;
// a null scope indicates it has already been 'cleaned up' so nothing to do (CUDeclaration.cleanUp())
if (classScope != null) {
CompilationUnitScope cuScope = classScope.compilationUnitScope();
LookupEnvironment environment = classScope.environment();
MethodVerifier verifier = environment.methodVerifier();
cuScope.verifyMethods(verifier);
}
SyntheticMethodBinding[] syntheticMethodBindings = ((SourceTypeBinding) jdtBinding).syntheticMethods();
if (syntheticMethodBindings != null) {
for (int i = 0; i < syntheticMethodBindings.length; i++) {
if (syntheticMethodBindings[i].isConstructor()) {
ConstructorNode cNode = constructorBindingToConstructorNode(bindings[i]);
addConstructor(cNode);
} else {
MethodNode mNode = methodBindingToMethodNode(syntheticMethodBindings[i]);
addMethod(mNode);
}
}
}
}
```
|
UtilitiesFacade is a java class from an internal java library that is used as a dependency. That has the format below. The utility classes just have instance methods, no static methods. public final class UtilitiesFacade {
private UtilitiesFacade() {
}
@NonNull public static final IOUtils ioUtils = new IOUtils();
@NonNull public static final XUtils xUtils=new XUtils();
@NonNull public static final YUtils yUtils=new YUtils();
} |
Does completion work in the same situation for one of the other utility classes? I wonder if IOUtils is the source of the issue.
|
No, it fails for all of them. It correctly completes from UtilitiesFacade but not from any of its fields. |
eric-milles
added a commit
that referenced
this issue
Jun 26, 2017
all working fine now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm hitting a situation that consistently causes the error below. I'm using groovy compiler 2.4.11. The situation that causes this to happen is a library that I'm using that has the following pattern.
Where UtilitiesFacade is a class that has static instances of other classes such as "ioUtils". The error happens when attempting to do code completion after the ioUtils piece. The error happens to other sibling fields also such as "UtilitiesFacade.xUtils."
Eclipse version: Neon
Groovy Eclipse - 2.9.2.xx-201706120159-e46
The text was updated successfully, but these errors were encountered: