-
Notifications
You must be signed in to change notification settings - Fork 194
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
NPE happens in Java Builder with enabled annotation-based analysis and groovy #931
Comments
Can you provide |
The one addition GDT makes to BinaryTypeBinding does show up in your stack trace:
private IBinaryMethod[] createMethods(IBinaryMethod[] iMethods, IBinaryType binaryType, long sourceLevel, char[][][] missingTypeNames) {
...
boolean hasRestrictedAccess = hasRestrictedAccess();
MethodBinding[] methods1 = new MethodBinding[total];
if (total == initialTotal) {
...
} else {
IBinaryMethod[] mappedBinaryMethods = new IBinaryMethod[total];
for (int i = 0, index = 0; i < initialTotal; i++) {
if (iClinit != i && (toSkip == null || toSkip[i] != -1)) {
MethodBinding method = createMethod(iMethods[i], binaryType, sourceLevel, missingTypeNames);
if (hasRestrictedAccess)
method.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
mappedBinaryMethods[index] = iMethods[i];
methods1[index++] = method;
}
}
this.methods = methods1;
// GROOVY add -- save the bridge methods; Groovy needs to see them
if (this.environment.globalOptions.buildGroovyFiles == 2) {
int skipped = (initialTotal - this.methods.length - (iClinit == -1 ? 0 : 1));
if (skipped == 0) {
this.infraMethods = Binding.NO_METHODS;
} else {
this.infraMethods = new MethodBinding[skipped];
for (int i = 0, index = 0; i < initialTotal; i += 1) {
if (iClinit != i && (toSkip != null && toSkip[i] == -1)) {
MethodBinding method = createMethod(iMethods[i], binaryType, sourceLevel, missingTypeNames); // this is line 1025
if (hasRestrictedAccess)
method.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
this.infraMethods[index++] = method;
}
}
}
}
// GROOVY end What's going on here is that Groovy needs to see the bridge methods for covariant checks. It uses the same call sequence that JDT does to create the method binding. It's possible this needs to shift up a line si that |
I will try to provide an example. But the error happens on a big project with multiple modules. So that will take some time. |
Does this still happen with the latest snapshot? If you're looking for something specific, I think the error is happening for an inner class (possibly anonymous). |
Updated to 3.5.0.v201908052119-e1906 |
Reproduced NPE using public project spotify/apollo
|
The error can be fixed by replacing I'm not getting the NPE. Are you running eclipse or building your project with Java 9+? I'm just trying to find something different about our setups. |
I have tried Oracle JDK 1.8.0_171 and 1.8.0_201. The error happens after any full rebuild.
|
java-compiler-preferences.epf.txt I am using javax.annotation.*: |
Can you try again with the latest snapshot? |
Now it works fine. Thanks |
error.txt
NPE happens when Groovy plugin installed and annotation-based null analysis enabled.
Disabling of annotation-based null analysis everything fixes errors. (As well as Groovy plugin removal)
My project is java project with many modules. Main sources include only java. Groovy is used for testing. Tests are based on Spock framework. In these tests we have non-standard naming (from the java point of view), something like this:
def "run scenario and perform checks"() { ... }
Otherwise this project is standard maven-based project. Internal compiler error appearing in "Problems" never relates to groovy code. Usually I can see 2 or 3 errors relating java files. For the same set of modules I get the same errors.
Groovy plugin: Groovy Development Tools 3.5.0.SNAPSHOT (installed from marketplace)
The error was discovered long time ago, and can be reproduced with earlier versions of eclipse and groovy plugin.
The text was updated successfully, but these errors were encountered: