diff options
author | Colin Cross <ccross@android.com> | 2018-06-20 09:43:38 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2018-06-21 18:27:32 +0000 |
commit | 7cc71d4daa695734f69f56eeb1d664139c4d567f (patch) | |
tree | 2f70a5682b27396caa59091f11ff4bc92166fa7c | |
parent | 412581b5f4ee80c50561e9501c1115b2d37e92f6 (diff) | |
download | error_prone-7cc71d4daa695734f69f56eeb1d664139c4d567f.tar.gz |
Update ErrorProne config for running inside javac from OpenJDK9android-p-preview-5android-p-preview-4
ErrorProne requires separating error prone flags from javac flags
when run inside javac as a processor plugin.
Also pass values to Soong as lists so it can use them as space or
colon delimited lists.
Bug: 69485063
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: Idea236c2bc8311cccdfc707dfabe72f033198514
-rw-r--r-- | soong/error_prone.go | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/soong/error_prone.go b/soong/error_prone.go index 5262bd9..1926c5e 100644 --- a/soong/error_prone.go +++ b/soong/error_prone.go @@ -15,26 +15,23 @@ package error_prone import ( - "strings" - "android/soong/java/config" ) func init() { // These values are set into build/soong/java/config/config.go so that soong doesn't have any // references to external/error_prone, which may not always exist. - config.ErrorProneJavacJar = "external/error_prone/javac/javac-9+181-r4173-1.jar" - config.ErrorProneJar = "external/error_prone/error_prone/error_prone_core-2.3.1-with-dependencies.jar" - config.ErrorProneClasspath = strings.Join([]string{ + config.ErrorProneClasspath = []string{ + "external/error_prone/error_prone/error_prone_core-2.3.1-with-dependencies.jar", "external/error_prone/error_prone/error_prone_annotations-2.3.1.jar", "external/error_prone/error_prone/error_prone_type_annotations-2.3.1.jar", "external/error_prone/checkerframework/dataflow-2.5.0.jar", "external/error_prone/checkerframework/javacutil-2.5.0.jar", "external/error_prone/jFormatString/jFormatString-3.0.0.jar", - }, ":") + } // The checks that are fatal to the build. - config.ErrorProneChecksError = strings.Join([]string{ + config.ErrorProneChecksError = []string{ // Errorprone default severity ERROR "-Xep:AndroidInjectionBeforeSuper:ERROR", "-Xep:ArrayFillIncompatibleType:ERROR", @@ -111,10 +108,10 @@ func init() { "-Xep:VarTypeName:ERROR", // Errorprone default severity WARNING // Errorprone default severity SUGGESTION - }, " ") + } // The checks that are not fatal to the build. - config.ErrorProneChecksWarning = strings.Join([]string{ + config.ErrorProneChecksWarning = []string{ // Errorprone default severity ERROR "-Xep:ArrayEquals:WARN", "-Xep:ArrayHashCode:WARN", @@ -248,11 +245,11 @@ func init() { // "-Xep:WakelockReleasedDangerously:WARN", // Errorprone default severity SUGGESTION - }, " ") + } // The checks that are default-disabled and listed for completeness // and simple experiments. - config.ErrorProneChecksDefaultDisabled = strings.Join([]string{ + config.ErrorProneChecksDefaultDisabled = []string{ // Errorprone default severity ERROR // "-Xep:AssistedInjectAndInjectOnSameConstructor:ERROR", // "-Xep:AutoFactoryAtInject:ERROR", @@ -335,10 +332,15 @@ func init() { // "-Xep:UnnecessaryStaticImport:SUGGESTION", // "-Xep:UseBinds:SUGGESTION", // "-Xep:WildcardImport:SUGGESTION", - }, " ") + } + + config.ErrorProneChecksOff = []string{ + // We are not interested in Guava recommendations + // for String.split. + "-Xep:StringSplitter:OFF", + } - config.ErrorProneFlags = strings.Join([]string{ - "com.google.errorprone.ErrorProneCompiler", + config.ErrorProneFlags = []string{ "-Xdiags:verbose", "-XDcompilePolicy=simple", "-XDallowBetterNullChecks=false", @@ -347,10 +349,20 @@ func init() { "-XDuseStructuralMostSpecificResolution=true", "-XDuseGraphInference=true", "-XDandroidCompatible=true", - // We are not interested in Guava recommendations - // for String.split. - "-Xep:StringSplitter:OFF", - "-Xmaxwarns 9999999", // As we emit errors as warnings, - // increase the warning limit. - }, " ") + // As we emit errors as warnings, + // increase the warning limit. + "-Xmaxwarns 9999999", + + // Extra flags needed by ErrorProne for OpenJDK9 from + // http://errorprone.info/docs/installation + "-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", + "-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", + "-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", + "-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", + "-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", + "-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED", + "-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", + "-J--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED", + "-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED", + } } |