Skip to content
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 issue on JDK 17 #5787

Closed
beikov opened this issue Apr 20, 2023 · 4 comments
Closed

NPE issue on JDK 17 #5787

beikov opened this issue Apr 20, 2023 · 4 comments
Labels

Comments

@beikov
Copy link

beikov commented Apr 20, 2023

I'm using the checker-framework 3.32 through the Gradle plugin version 0.6.25 and we are seeing a NPE when running on JDK 17:

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.TreeSet.clear()" because "this.messageStore" is null
	at org.checkerframework.common.basetype.BaseTypeChecker.typeProcess(BaseTypeChecker.java:537)
	at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:188)
	at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:854)
	at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1394)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1351)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
	... 31 more

The repository is https:/hibernate/hibernate-orm and we run with the following config:

checkerFramework {
	checkers = [
			'org.checkerframework.checker.nullness.NullnessChecker'
	]
	extraJavacArgs = [
	        '-AsuppressWarnings=initialization',
			"-Astubs=${project.rootDir}/checkerstubs",
			'-AonlyDefs=^org\\.hibernate\\.jpamodelgen\\.'
	]
}

I expect it to work just like with JDK 11. Any idea what the reason for this could be? No checker should run for that compile task as the onlyDefs config applies for packages of a different gradle module.

@beikov
Copy link
Author

beikov commented Apr 25, 2023

Any ideas what is going on here?

@smillst smillst added the crash label Apr 26, 2023
@smillst
Copy link
Member

smillst commented Apr 26, 2023

I can't tell what's going on from this exception. Can you tell me how to reproduce the exception? Is it only happening on JDK 17?

@beikov
Copy link
Author

beikov commented Apr 27, 2023

  1. Checkout the Git repository https:/hibernate/hibernate-orm
  2. Make sure your JAVA_HOME points to a JDK 11
  3. Run the build with ./gradlew :hibernate-core:compileTestJava17Java -Ptest.jdk.version=17 -Porg.gradle.java.installations.paths=<JDK_11_HOME>,<JDK_17_HOME>

The first time might take some time, but subsequent runs will be faster.

@beikov
Copy link
Author

beikov commented Apr 27, 2023

Ok, it seems this is a problem of the Gradle plugin. It didn't add the compileOnly dependency to the compile task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants