-
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
Compile error - No such class: jdk.Profile+Annotation #1231
Comments
BTW: This issue was the reason why I asked in #1223 (comment) about a newer version of the compiler (I hoped a newer version could have a fix 😄). |
Update: I tried a number of scenarios and found that using Java 9+ to build with a target of Java 8 can work with the current The parent POM here sets the release config value when maven is run with Java 9+. Clearing this value allows the sample project to build successfully: <properties>
<maven.compiler.release></maven.compiler.release>
</properties> You could also choose to run the compiler in a separate process (Java 8 or Java 9+), which also works if the release value is cleared: <properties>
<maven.compiler.fork>true</maven.compiler.fork>
<maven.compiler.release></maven.compiler.release>
</properties> Also, there is a newer batch compiler artifact (3.0.7-02) than the one you are using (3.0.7-01). Batch compiler 2.5.14-03 and 3.0.8-02 will deal with the |
In this case, there is an AST transform that is calling @Override
public Class getTypeClass() {
if (hasClass()) return clazz;
throw new MissingClassException(this, "-- JDTClassNode.getTypeClass() cannot locate it using transform loader");
}
@Override
public boolean hasClass() {
if (clazz == null && !unfindable) {
// Some AST transforms are written such that they refer to typeClass on a ClassNode.
// This is not available within Eclipse. However, we can support it in a rudimentary
// fashion by attempting a class load using the transform loader (if it's available).
ClassLoader transformLoader = resolver.compilationUnit.getTransformLoader();
if (transformLoader != null) {
try {
clazz = Class.forName(getName(), false, transformLoader);
} catch (ReflectiveOperationException | LinkageError e) {
unfindable = true;
}
}
}
return (clazz != null);
}
|
A few days ago, I had faced an issue that only appears under JDK >=11 but not under JDK 8.
The error was:
Groovy: compiler error: exception in phase 'canonicalization' in source unit '/private/tmp/j11i/groovy-eclipse-compiler-jdk11-issue/src/main/java/compilerissue/Foo.groovy' No such class: jdk.Profile+Annotation -- JDTClassNode.getTypeClass() cannot locate it using transform loader
I was not able to nail down the issue itself. To share the problem, I've isolated and shrunk the project as much as I could. A full example with one small class and one pom.xml is in this repo:
https://github.com/walery/groovy-eclipse-compiler-jdk11-issue
The main purpose is to share the problem with you. I've fixed it by switching to gmavenplus plugin.
The text was updated successfully, but these errors were encountered: