-
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
Consider providing a com.sun.source.util.Plugin? #535
Comments
This allows Error Prone to be used as a javac plugin (instead of a wrapper) via the plugin API that was added in 8: https://docs.oracle.com/javase/8/docs/jdk/api/javac/tree/com/sun/source/util/Plugin.html Demo: ``` javac -J-Xbootclasspath/p:javac-9-dev-r3297-3.jar \ -processorpath error_prone_ant-2.0.18-SNAPSHOT.jar \ -Xplugin:ErrorProne Test.java ... ShortSet.java:8: error: [CollectionIncompatibleType] Argument 'i - 1' should not be passed to this method; its type int is not compatible with its collection's type argument Short s.remove(i - 1); ^ (see http://errorprone.info/bugpattern/CollectionIncompatibleType) ``` See #535 MOE_MIGRATED_REVID=148835033
I pushed an initial implementation in feb4b34, and verified that it works for simple examples. I'd be interested in feedback if you get a chance to try using this with Buck.
|
Would that mean that i could simplify EP in Buck integration, added here facebook/buck#1047? |
@cushon, I'm getting a following stack trace when using
I'm I doing something obviously wrong? Is |
I am also getting a similar error |
Please start a new bug, and include the steps to reproduce the problem you're seeing. |
Hi folks, sorry to bring back an old thread. But did anyone solve the error above #535 (comment)? |
I can reproduce:
The It does work with JDK 9:
And it also works if you override JDK 8's javac with the Error Prone javac:
@tbroyer is there a way to make gradle do the equivalent of overriding the host JDK's javac using |
It might be possible to pass that as part of |
I ended up doing this: wpilibsuite/allwpilib#1265 |
@cushon So, apparently, configurations {
javac
}
dependencies {
javac 'com.google.errorprone:javac:9+181-r4173-1'
}
tasks.withType(JavaCompile) {
options.fork = true
options.forkOptions.jvmArgs.add("-Xbootclasspath/p:${configurations.javac.asPath}" })
} (this is |
Nice. Do you think we should be recommending that configuration and trying to converge on the |
If you're ready to recommend that on the command line too, then yes; that would make things simpler for everyone (same configuration whichever the JDK, except for an additional bootclasspath entry when using JDK 8). |
and delete the legacy ant compiler adapter. MOE_MIGRATED_REVID=209509256
I recently became aware of ErrorProne as @davido is working to integrate it into Buck. Glancing at the code, it looks like the key reason for exposing it as a compiler is to get a
TaskListener
into place, which is exactly what the Plugin facility lets you do injavac
8 and higher.Plugin
s can be auto-discovered on the processor path (just like annotation processors), which would make it more straightforward to run ErrorProne even with command-linejavac
, and of course any build system that supportsPlugin
s (I'm working to add such support to Buck) would no longer require a special integration.The text was updated successfully, but these errors were encountered: