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

Inject a filtering classloader for annotation processor classpath #9899

Merged
merged 3 commits into from Jul 10, 2019

Conversation

ghale
Copy link
Member

@ghale ghale commented Jul 8, 2019

Fixes #9897

When an annotation processor path is set, but there are no declared annotation processors, the Java compiler creates a new classloader for the annotation processor classpath that hangs off of the system classloader which may have other classes visible that could interfere with an annotation processor. This change injects a filter in between the annotation processor classpath and the system classloader exactly like what we do when an annotation processor is declared.

@big-guy big-guy added this to the 5.5.1 milestone Jul 9, 2019
@big-guy big-guy merged commit 96dce94 into release Jul 10, 2019

${mavenCentralRepository()}

if (JavaVersion.current().java8) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the plugin does this check already, you can declare the dependency unconditionally; the errorproneJavac configuration will only ever be resolved when running with Java 8.

tasks.withType(JavaCompile).configureEach {
options.fork = true
options.errorprone {
check("DoubleBraceInitialization", net.ltgt.gradle.errorprone.CheckSeverity.ERROR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may have wanted to use error("DoubleBraceInitialization") instead.

@ghale ghale deleted the gh/issues/9897 branch May 1, 2020 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants