Skip to content

Commit

Permalink
Merge branch 'master' into try-method-match
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar authored Aug 11, 2023
2 parents 4afd3d9 + 9ee04c2 commit aa2bc8c
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 24 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.20.0
epVersion: 2.21.1
- os: ubuntu-latest
java: 11
epVersion: 2.20.0
epVersion: 2.21.1
- os: windows-latest
java: 11
epVersion: 2.20.0
epVersion: 2.21.1
- os: ubuntu-latest
java: 17
epVersion: 2.20.0
epVersion: 2.21.1
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
with:
arguments: coveralls
continue-on-error: true
if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.20.0' && github.repository == 'uber/NullAway'
if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.21.1' && github.repository == 'uber/NullAway'
- name: Test publishToMavenLocal flow
env:
ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }}
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ buildscript {
}
}
plugins {
id "com.diffplug.spotless" version "6.19.0"
id "com.diffplug.spotless" version "6.20.0"
id "net.ltgt.errorprone" version "3.0.1" apply false
id "com.github.johnrengelman.shadow" version "8.1.0" apply false
id "com.github.johnrengelman.shadow" version "8.1.1" apply false
id "com.github.kt3k.coveralls" version "2.12.0" apply false
id "me.champeau.jmh" version "0.6.8" apply false
id "com.github.ben-manes.versions" version "0.42.0"
id "me.champeau.jmh" version "0.7.1" apply false
id "com.github.ben-manes.versions" version "0.47.0"
}

repositories {
Expand Down
8 changes: 4 additions & 4 deletions 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.20.0"
def latestErrorProneVersion = "2.21.1"
// Default to using latest tested Error Prone version
def defaultErrorProneVersion = latestErrorProneVersion
def errorProneVersionToCompileAgainst = defaultErrorProneVersion
Expand Down Expand Up @@ -48,10 +48,10 @@ def versions = [
// The version of Error Prone that NullAway is compiled and tested against
errorProneApi : errorProneVersionToCompileAgainst,
support : "27.1.1",
wala : "1.6.1",
wala : "1.6.2",
commonscli : "1.4",
autoValue : "1.9",
autoService : "1.0.1",
autoValue : "1.10.2",
autoService : "1.1.1",
]

def apt = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private void analyzeFile(String pkgName, String inPath, boolean includeNonPublic
} else if (!new File(inPath).exists()) {
return;
}
AnalysisScope scope = AnalysisScopeReader.instance.makePrimordialScope(null);
AnalysisScope scope = AnalysisScopeReader.instance.makeBasePrimordialScope(null);
scope.setExclusions(
new FileOfClasses(
new ByteArrayInputStream(DEFAULT_EXCLUSIONS.getBytes(StandardCharsets.UTF_8))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static boolean isStatic(Symbol symbol) {
* https://github.com/google/error-prone/blame/a1318e4b0da4347dff7508108835d77c470a7198/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L1148
* TODO: delete this method and switch to ASTHelpers once we can require Error Prone 2.20.0
*/
@SuppressWarnings("ASTHelpersSuggestions")
public static List<Symbol> getEnclosedElements(Symbol symbol) {
return symbol.getEnclosedElements();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import static com.uber.nullaway.ASTHelpersBackports.getEnclosedElements;

import com.google.common.base.Preconditions;
import com.google.errorprone.VisitorState;
import com.google.errorprone.suppliers.Supplier;
import com.google.errorprone.suppliers.Suppliers;
Expand All @@ -33,6 +32,7 @@
import com.sun.tools.javac.code.Types;
import com.uber.nullaway.NullAway;
import com.uber.nullaway.Nullness;
import com.uber.nullaway.annotations.Initializer;
import com.uber.nullaway.dataflow.AccessPath;
import com.uber.nullaway.dataflow.AccessPathNullnessPropagation;
import java.util.Objects;
Expand All @@ -54,8 +54,13 @@ public class ApacheThriftIsSetHandler extends BaseNoOpHandler {

private static final Supplier<Type> TBASE_TYPE_SUPPLIER = Suppliers.typeFromString(TBASE_NAME);

@Nullable private Optional<Type> tbaseType;
private Optional<Type> tbaseType;

/**
* This method is annotated {@code @Initializer} since it will be invoked when the first class is
* processed, before any other handler methods
*/
@Initializer
@Override
public void onMatchTopLevelClass(
NullAway analysis, ClassTree tree, VisitorState state, Symbol.ClassSymbol classSymbol) {
Expand Down Expand Up @@ -173,7 +178,6 @@ private static String decapitalize(String str) {
}

private boolean thriftIsSetCall(Symbol.MethodSymbol symbol, Types types) {
Preconditions.checkNotNull(tbaseType);
// noinspection ConstantConditions
return tbaseType.isPresent()
&& symbol.getSimpleName().toString().startsWith("isSet")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static com.uber.nullaway.ASTHelpersBackports.getEnclosedElements;
import static com.uber.nullaway.NullabilityUtil.castToNonNull;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.errorprone.VisitorState;
import com.google.errorprone.suppliers.Supplier;
Expand All @@ -37,6 +36,7 @@
import com.sun.tools.javac.code.Types;
import com.uber.nullaway.NullAway;
import com.uber.nullaway.Nullness;
import com.uber.nullaway.annotations.Initializer;
import com.uber.nullaway.dataflow.AccessPath;
import com.uber.nullaway.dataflow.AccessPathNullnessPropagation;
import java.util.ArrayList;
Expand All @@ -61,9 +61,14 @@ public class GrpcHandler extends BaseNoOpHandler {
private static final Supplier<Type> GRPC_METADATA_KEY_TYPE_SUPPLIER =
Suppliers.typeFromString(GRPC_METADATA_KEY_TNAME);

@Nullable private Optional<Type> grpcMetadataType;
@Nullable private Optional<Type> grpcKeyType;
private Optional<Type> grpcMetadataType;
private Optional<Type> grpcKeyType;

/**
* This method is annotated {@code @Initializer} since it will be invoked when the first class is
* processed, before any other handler methods
*/
@Initializer
@Override
public void onMatchTopLevelClass(
NullAway analysis, ClassTree tree, VisitorState state, Symbol.ClassSymbol classSymbol) {
Expand Down Expand Up @@ -135,8 +140,6 @@ private Symbol.MethodSymbol getGetterForMetadataSubtype(
}

private boolean grpcIsMetadataContainsKeyCall(Symbol.MethodSymbol symbol, Types types) {
Preconditions.checkNotNull(grpcMetadataType);
Preconditions.checkNotNull(grpcKeyType);
// noinspection ConstantConditions
return grpcMetadataType.isPresent()
&& grpcKeyType.isPresent()
Expand All @@ -149,8 +152,6 @@ private boolean grpcIsMetadataContainsKeyCall(Symbol.MethodSymbol symbol, Types
}

private boolean grpcIsMetadataGetCall(Symbol.MethodSymbol symbol, Types types) {
Preconditions.checkNotNull(grpcMetadataType);
Preconditions.checkNotNull(grpcKeyType);
// noinspection ConstantConditions
return grpcMetadataType.isPresent()
&& grpcKeyType.isPresent()
Expand Down

0 comments on commit aa2bc8c

Please sign in to comment.