-
Notifications
You must be signed in to change notification settings - Fork 742
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
java.lang.ExceptionInInitializerError in AutoValueSubclassLeaked caused by NullPointerException in Caffeine #1986
Comments
error-prone plugin [crashes](200~google/error-prone#1986) on Java 8, for that reason we remove Java 8 from the Travis-CI configuration.
error-prone plugin [crashes](google/error-prone#1986) on Java 8, for that reason we remove Java 8 from the Travis-CI configuration.
With diff --git a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/LocalCacheSelectorCode.java b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/LocalCacheSelectorCode.java
index a368046d..345ef392 100644
--- a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/LocalCacheSelectorCode.java
+++ b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/LocalCacheSelectorCode.java
@@ -99,7 +99,7 @@ public final class LocalCacheSelectorCode {
private LocalCacheSelectorCode selector() {
block
.beginControlFlow("try")
- .addStatement("$T<?> clazz = $T.class.getClassLoader().loadClass(sb.toString())",
+ .addStatement("$T<?> clazz = java.util.Objects.requireNonNull($T.class.getClassLoader(), \"oh no\").loadClass(sb.toString())",
Class.class, LOCAL_CACHE_FACTORY)
.addStatement("$T<?> ctor = clazz.getDeclaredConstructor($T.class, $T.class, $T.class)",
Constructor.class, BUILDER, CACHE_LOADER.rawType, TypeName.BOOLEAN) I see
I reported this against caffeine as ben-manes/caffeine#481 I'm not sure why gradle is using |
Thanks for taking a look. I dug into the Error Prone gradle plugin a little bit (which you can debug directly from intellij, kinda nice), see https://github.com/tbroyer/gradle-errorprone-plugin/blob/master/src/main/kotlin/net/ltgt/gradle/errorprone/ErrorPronePlugin.kt#L87 fun JavaCompile.configureErrorProneJavac() {
if (!options.isFork) {
options.isFork = true
// reset forkOptions in case they were configured
options.forkOptions = ForkOptions()
}
javacConfiguration.asPath.also {
if (it.isNotBlank()) {
options.forkOptions.jvmArgs!!.add("-Xbootclasspath/p:$it") // error prone and caffeine added to bootclasspath
} else if (noJavacDependencyNotified.compareAndSet(false, true)) {
LOGGER.warn(NO_JAVAC_DEPENDENCY_WARNING_MESSAGE)
}
}
} There is code further down in the plugin that does this only for Java 8: JavaVersion.current().isJava8 && (!options.isFork || (options.forkOptions.javaHome == null && options.forkOptions.executable == null)) ->
configureErrorProneJavac() Is this a problem with the plugin, or should Caffeine be able to operate in this mode? |
Thanks for investigating! @tbroyer FYI
Maybe kinda both? :) Ideally Caffeine would work in this mode, but if it's possible for the plugin to only put the |
Thank you for the bug report. Please upgrade caffeine to 2.8.8 to resolve this issue. |
Fixes #1986 PiperOrigin-RevId: 346253137
Fixes #1986 PiperOrigin-RevId: 346253137
The Gradle plugin will only put on the bootclasspath the dependencies declared in the This should be errorprone 'com.google.errorprone:error_prone_core:2.3.3'
errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1' |
Aha, thank you! |
error-prone plugin [crashes](google/error-prone#1986) on Java 8, for that reason we remove Java 8 from the Travis-CI configuration.
Fixes google#1986 PiperOrigin-RevId: 346387889
I'm getting the following crash inside error-prone on Java 8. Works fine on Java 11. It's not urgent for me, I'm happy to not support building on Java 8 at this point.
To reproduce
Make sure OpenJDK 8 is available in JAVA_HOME, this example assumes it's in
/usr/lib/java-8-openjdk-amd64/
.What version of Error Prone are you using?
2.4.0, invoked by net.ltgt.errorprone plugin version 1.3.0.
Have you found anything relevant by searching the web?
No luck.
The text was updated successfully, but these errors were encountered: