Skip to content

Commit

Permalink
Revert "Bump Error Prone and EP plugin (#675)"
Browse files Browse the repository at this point in the history
This reverts commit cc91371.
  • Loading branch information
msridhar committed Jul 18, 2023
1 parent 84c29b4 commit f58c37b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 32 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
epVersion: 2.4.0
- os: macos-latest
java: 11
epVersion: 2.16
epVersion: 2.15.0
- os: ubuntu-latest
java: 11
epVersion: 2.16
epVersion: 2.15.0
- os: windows-latest
java: 11
epVersion: 2.16
epVersion: 2.15.0
- os: ubuntu-latest
java: 17
epVersion: 2.16
epVersion: 2.15.0
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
with:
arguments: coveralls
continue-on-error: true
if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.16' && github.repository == 'uber/NullAway'
if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.15.0' && github.repository == 'uber/NullAway'
- name: Check that Git tree is clean after build and test
run: ./.buildscript/check_git_clean.sh
publish_snapshot:
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ buildscript {
}
plugins {
id "com.github.sherter.google-java-format" version "0.9"
id "net.ltgt.errorprone" version "3.0.1" apply false
id "net.ltgt.errorprone" version "2.0.2" apply false
id "com.github.johnrengelman.shadow" version "6.1.0" apply false
id "com.github.kt3k.coveralls" version "2.12.0" apply false
id "me.champeau.jmh" version "0.6.7" apply false
Expand All @@ -54,6 +54,7 @@ subprojects { project ->
project.apply plugin: "net.ltgt.errorprone"
project.dependencies {
errorprone deps.build.errorProneCore
errorproneJavac deps.build.errorProneJavac
}
project.tasks.withType(JavaCompile) {
dependsOn(installGitHooks)
Expand Down
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.gradle.util.VersionNumber
// The oldest version of Error Prone that we support running on
def oldestErrorProneVersion = "2.4.0"
// Latest released Error Prone version that we've tested with
def latestErrorProneVersion = "2.16"
def latestErrorProneVersion = "2.15.0"
// Default to using latest tested Error Prone version, except on Java 8, where 2.10.0 is the last version
// that works
def defaultErrorProneVersion = JavaVersion.current() >= JavaVersion.VERSION_11 ? latestErrorProneVersion : "2.10.0"
Expand Down
11 changes: 4 additions & 7 deletions nullaway/src/main/java/com/uber/nullaway/CodeAnnotationInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,16 @@ public static CodeAnnotationInfo instance(Context context) {
private static boolean fromAnnotatedPackage(
Symbol.ClassSymbol outermostClassSymbol, Config config) {
final String className = outermostClassSymbol.getQualifiedName().toString();
Symbol.PackageSymbol enclosingPackage = ASTHelpers.enclosingPackage(outermostClassSymbol);
if (!config.fromExplicitlyAnnotatedPackage(className)
&& !(enclosingPackage != null
&& ASTHelpers.hasDirectAnnotationWithSimpleName(
enclosingPackage, NullabilityUtil.NULLMARKED_SIMPLE_NAME))) {
&& !ASTHelpers.hasDirectAnnotationWithSimpleName(
outermostClassSymbol.packge(), NullabilityUtil.NULLMARKED_SIMPLE_NAME)) {
// By default, unknown code is unannotated unless @NullMarked or configured as annotated by
// package name
return false;
}
if (config.fromExplicitlyUnannotatedPackage(className)
|| (enclosingPackage != null
&& ASTHelpers.hasDirectAnnotationWithSimpleName(
enclosingPackage, NullabilityUtil.NULLUNMARKED_SIMPLE_NAME))) {
|| ASTHelpers.hasDirectAnnotationWithSimpleName(
outermostClassSymbol.packge(), NullabilityUtil.NULLUNMARKED_SIMPLE_NAME)) {
// Any code explicitly marked as unannotated in our configuration is unannotated, no matter
// what. Similarly, any package annotated as @NullUnmarked is unannotated, even if
// explicitly passed to -XepOpt:NullAway::AnnotatedPackages
Expand Down
4 changes: 1 addition & 3 deletions nullaway/src/main/java/com/uber/nullaway/ErrorBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,7 @@ void reportInitErrorOnField(Symbol symbol, VisitorState state, Description.Build
fieldName = flatName.substring(index) + "." + fieldName;
}

@SuppressWarnings("ASTHelpersSuggestions") // remove once we require EP 2.16 or greater
boolean isStatic = symbol.isStatic();
if (isStatic) {
if (symbol.isStatic()) {
state.reportMatch(
createErrorDescription(
new ErrorMessage(
Expand Down
12 changes: 3 additions & 9 deletions nullaway/src/main/java/com/uber/nullaway/NullAway.java
Original file line number Diff line number Diff line change
Expand Up @@ -988,9 +988,7 @@ private Description checkForReadBeforeInit(ExpressionTree tree, VisitorState sta
}

// for static fields, make sure the enclosing init is a static method or block
@SuppressWarnings("ASTHelpersSuggestions") // remove once we require EP 2.16 or greater
boolean isStatic = symbol.isStatic();
if (isStatic) {
if (symbol.isStatic()) {
Tree enclosing = enclosingBlockPath.getLeaf();
if (enclosing instanceof MethodTree
&& !ASTHelpers.getSymbol((MethodTree) enclosing).isStatic()) {
Expand Down Expand Up @@ -1099,9 +1097,7 @@ private boolean fieldAlwaysInitializedBeforeRead(
Symbol symbol, TreePath pathToRead, VisitorState state, TreePath enclosingBlockPath) {
AccessPathNullnessAnalysis nullnessAnalysis = getNullnessAnalysis(state);
Set<Element> nonnullFields;
@SuppressWarnings("ASTHelpersSuggestions") // remove once we require EP 2.16 or greater
boolean isStatic = symbol.isStatic();
if (isStatic) {
if (symbol.isStatic()) {
nonnullFields = nullnessAnalysis.getNonnullStaticFieldsBefore(pathToRead, state.context);
} else {
nonnullFields = new LinkedHashSet<>();
Expand Down Expand Up @@ -2067,9 +2063,7 @@ private FieldInitEntities collectEntities(ClassTree tree, VisitorState state) {
// matchVariable()
continue;
}
@SuppressWarnings("ASTHelpersSuggestions") // remove once we require EP 2.16 or greater
boolean fieldIsStatic = fieldSymbol.isStatic();
if (fieldIsStatic) {
if (fieldSymbol.isStatic()) {
nonnullStaticFields.add(fieldSymbol);
} else {
nonnullInstanceFields.add(fieldSymbol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,9 @@ public static AccessPath fromFieldElement(VariableElement element) {
}

private static boolean isBoxingMethod(Symbol.MethodSymbol methodSymbol) {
if (methodSymbol.isStatic() && methodSymbol.getSimpleName().contentEquals("valueOf")) {
Symbol.PackageSymbol enclosingPackage = ASTHelpers.enclosingPackage(methodSymbol.enclClass());
return enclosingPackage != null && enclosingPackage.fullname.contentEquals("java.lang");
}
return false;
return methodSymbol.isStatic()
&& methodSymbol.getSimpleName().contentEquals("valueOf")
&& methodSymbol.enclClass().packge().fullname.contentEquals("java.lang");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,6 @@ private CodeAnnotationInfo getCodeAnnotationInfo(VisitorState state) {
return codeAnnotationInfo;
}

@SuppressWarnings("ASTHelpersSuggestions") // remove once we require EP 2.16 or greater
private void setReceiverNonnull(
AccessPathNullnessPropagation.ReadableUpdates updates, Node receiver, Symbol symbol) {
if (symbol != null && !symbol.isStatic()) {
Expand Down

0 comments on commit f58c37b

Please sign in to comment.