Skip to content

Commit 92c9304

Browse files
authored
Update to Error Prone 2.41.0 (uber#1239)
Almost all the code fixes are for the new [EffectivelyPrivate](https://errorprone.info/bugpattern/EffectivelyPrivate) check. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated Error Prone version to 2.41.0 across all environments. * **Refactor** * Improved internal code encapsulation by restricting visibility of constructors, fields, and methods in multiple components without affecting user-facing functionality. * **Tests** * Added test annotation to a suppression suggestion test method for improved test execution. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent dc07f65 commit 92c9304

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
epVersion: 2.31.0
2626
- os: macos-latest
2727
java: 17
28-
epVersion: 2.39.0
28+
epVersion: 2.41.0
2929
- os: windows-latest
3030
java: 17
31-
epVersion: 2.39.0
31+
epVersion: 2.41.0
3232
- os: ubuntu-latest
3333
java: 17
34-
epVersion: 2.39.0
34+
epVersion: 2.41.0
3535
fail-fast: false
3636
runs-on: ${{ matrix.os }}
3737
steps:
@@ -60,7 +60,7 @@ jobs:
6060
ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }}
6161
run: ./gradlew codeCoverageReport
6262
continue-on-error: true
63-
if: runner.os == 'Linux' && matrix.java == '17' && matrix.epVersion == '2.39.0' && github.repository == 'uber/NullAway'
63+
if: runner.os == 'Linux' && matrix.java == '17' && matrix.epVersion == '2.41.0' && github.repository == 'uber/NullAway'
6464
- name: Upload coverage reports to Codecov
6565
uses: codecov/codecov-action@v4
6666
with:

gradle/dependencies.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import org.gradle.util.VersionNumber
1919
// The oldest version of Error Prone that we support running on
2020
def oldestErrorProneVersion = "2.14.0"
2121
// Latest released Error Prone version that we've tested with
22-
def latestErrorProneVersion = "2.39.0"
22+
def latestErrorProneVersion = "2.41.0"
2323
// Default to using latest tested Error Prone version
2424
def defaultErrorProneVersion = latestErrorProneVersion
2525
def errorProneVersionToCompileAgainst = defaultErrorProneVersion

library-model/library-model-generator/src/main/java/com/uber/nullaway/libmodel/LibraryModelGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ private static class AnnotationCollectorCallback implements SourceRoot.Callback
192192

193193
private final AnnotationCollectionVisitor annotationCollectionVisitor;
194194

195-
public AnnotationCollectorCallback(LibraryModelData modelData) {
195+
AnnotationCollectorCallback(LibraryModelData modelData) {
196196
this.annotationCollectionVisitor = new AnnotationCollectionVisitor(modelData);
197197
}
198198

@@ -220,7 +220,7 @@ private static class AnnotationCollectionVisitor extends VoidVisitorAdapter<Void
220220
private static final String NULLABLE = "Nullable";
221221
private static final String JSPECIFY_NULLABLE_IMPORT = "org.jspecify.annotations.Nullable";
222222

223-
public AnnotationCollectionVisitor(LibraryModelData modelData) {
223+
AnnotationCollectionVisitor(LibraryModelData modelData) {
224224
this.methodRecords = modelData.methodRecords;
225225
this.nullableUpperBounds = modelData.nullableUpperBounds;
226226
this.nullMarkedClasses = modelData.nullMarkedClasses;

nullaway/src/main/java/com/uber/nullaway/CodeAnnotationInfo.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,17 +319,17 @@ private boolean isAnnotatedTopLevelClass(
319319
* key used to retrieve it.
320320
*/
321321
private static final class ClassCacheRecord {
322-
public final Symbol.ClassSymbol outermostClassSymbol;
323-
public final boolean isNullnessAnnotated;
324-
public final Map<Symbol.MethodSymbol, Boolean> methodNullnessCache;
322+
final Symbol.ClassSymbol outermostClassSymbol;
323+
final boolean isNullnessAnnotated;
324+
final Map<Symbol.MethodSymbol, Boolean> methodNullnessCache;
325325

326-
public ClassCacheRecord(Symbol.ClassSymbol outermostClassSymbol, boolean isAnnotated) {
326+
ClassCacheRecord(Symbol.ClassSymbol outermostClassSymbol, boolean isAnnotated) {
327327
this.outermostClassSymbol = outermostClassSymbol;
328328
this.isNullnessAnnotated = isAnnotated;
329329
this.methodNullnessCache = new HashMap<>();
330330
}
331331

332-
public boolean isMethodNullnessAnnotated(Symbol.MethodSymbol methodSymbol) {
332+
boolean isMethodNullnessAnnotated(Symbol.MethodSymbol methodSymbol) {
333333
return methodNullnessCache.computeIfAbsent(
334334
methodSymbol,
335335
m -> {

nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPath.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ private static final class StringMapKey implements MapKey {
647647

648648
private final String key;
649649

650-
public StringMapKey(String key) {
650+
StringMapKey(String key) {
651651
this.key = key;
652652
}
653653

@@ -669,7 +669,7 @@ private static final class NumericMapKey implements MapKey {
669669

670670
private final long key;
671671

672-
public NumericMapKey(long key) {
672+
NumericMapKey(long key) {
673673
this.key = key;
674674
}
675675

nullaway/src/main/java/com/uber/nullaway/handlers/ApacheThriftIsSetHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private static final class FieldAndGetterElements {
115115

116116
final @Nullable Element getterElem;
117117

118-
public FieldAndGetterElements(@Nullable Element fieldElem, @Nullable Element getterElem) {
118+
FieldAndGetterElements(@Nullable Element fieldElem, @Nullable Element getterElem) {
119119
this.fieldElem = fieldElem;
120120
this.getterElem = getterElem;
121121
}

nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ private static class CombinedLibraryModels implements LibraryModels {
967967

968968
private final ImmutableList<StreamTypeRecord> customStreamNullabilitySpecs;
969969

970-
public CombinedLibraryModels(Iterable<LibraryModels> models, Config config) {
970+
CombinedLibraryModels(Iterable<LibraryModels> models, Config config) {
971971
this.config = config;
972972
ImmutableSetMultimap.Builder<MethodRef, Integer> failIfNullParametersBuilder =
973973
new ImmutableSetMultimap.Builder<>();
@@ -1168,7 +1168,7 @@ private static class NameIndexedMap<T> {
11681168
this.state = state;
11691169
}
11701170

1171-
public @Nullable T get(Symbol.MethodSymbol symbol) {
1171+
@Nullable T get(Symbol.MethodSymbol symbol) {
11721172
Map<MethodRef, T> methodRefTMap = state.get(symbol.name);
11731173
if (methodRefTMap == null) {
11741174
return null;
@@ -1177,7 +1177,7 @@ private static class NameIndexedMap<T> {
11771177
return methodRefTMap.get(ref);
11781178
}
11791179

1180-
public boolean nameNotPresent(Symbol.MethodSymbol symbol) {
1180+
boolean nameNotPresent(Symbol.MethodSymbol symbol) {
11811181
return state.get(symbol.name) == null;
11821182
}
11831183
}
@@ -1192,7 +1192,7 @@ public boolean nameNotPresent(Symbol.MethodSymbol symbol) {
11921192
private final NameIndexedMap<Boolean> nonNullRet;
11931193
private final NameIndexedMap<ImmutableSet<Integer>> castToNonNullMethods;
11941194

1195-
public OptimizedLibraryModels(LibraryModels models, Context context) {
1195+
OptimizedLibraryModels(LibraryModels models, Context context) {
11961196
Names names = Names.instance(context);
11971197
failIfNullParams = makeOptimizedIntSetLookup(names, models.failIfNullParameters());
11981198
explicitlyNullableParams =
@@ -1207,11 +1207,11 @@ public OptimizedLibraryModels(LibraryModels models, Context context) {
12071207
castToNonNullMethods = makeOptimizedIntSetLookup(names, models.castToNonNullMethods());
12081208
}
12091209

1210-
public boolean hasNonNullReturn(Symbol.MethodSymbol symbol, Types types, boolean checkSuper) {
1210+
boolean hasNonNullReturn(Symbol.MethodSymbol symbol, Types types, boolean checkSuper) {
12111211
return lookupHandlingOverrides(symbol, types, nonNullRet, checkSuper) != null;
12121212
}
12131213

1214-
public boolean hasNullableReturn(Symbol.MethodSymbol symbol, Types types, boolean checkSuper) {
1214+
boolean hasNullableReturn(Symbol.MethodSymbol symbol, Types types, boolean checkSuper) {
12151215
return lookupHandlingOverrides(symbol, types, nullableRet, checkSuper) != null;
12161216
}
12171217

nullaway/src/main/java/com/uber/nullaway/handlers/OptionalEmptinessHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,7 @@ private boolean optionalIsGetCall(Symbol.MethodSymbol symbol, Types types) {
308308
* directly.
309309
*/
310310
private static final class OptionalContentVariableElement implements VariableElement {
311-
public static final Context.Key<OptionalContentVariableElement> contextKey =
312-
new Context.Key<>();
311+
static final Context.Key<OptionalContentVariableElement> contextKey = new Context.Key<>();
313312

314313
private static final ImmutableSet<Modifier> MODIFIERS =
315314
ImmutableSet.of(Modifier.PUBLIC, Modifier.FINAL);

nullaway/src/test/java/com/uber/nullaway/AutoSuggestTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ public void suggestCastToNonNullPreserveComments() throws IOException {
318318
.doTest(TEXT_MATCH);
319319
}
320320

321-
public void suggestInitSuppressionOnConstructor() throws IOException {
321+
@Test
322+
public void suggestInitSuppressionOnConstructor() {
322323
makeTestHelper()
323324
.addInputLines(
324325
"Test.java",

0 commit comments

Comments
 (0)