-
Notifications
You must be signed in to change notification settings - Fork 288
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
Update to Error Prone 2.21.1 #797
Changes from 2 commits
6cc20b4
b8edf31
d11e49e
b923cd4
8d7fa4c
fb935f6
b02777c
912e82a
f44ac1b
282e986
6741ef3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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; | ||
|
@@ -54,17 +54,26 @@ 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; | ||
|
||
@Override | ||
public void onMatchTopLevelClass( | ||
NullAway analysis, ClassTree tree, VisitorState state, Symbol.ClassSymbol classSymbol) { | ||
if (tbaseType == null) { | ||
tbaseType = | ||
Optional.ofNullable(TBASE_TYPE_SUPPLIER.get(state)).map(state.getTypes()::erasure); | ||
init(state); | ||
} | ||
} | ||
|
||
/** | ||
* This method is annotated {@code @Initializer} since it will be invoked when the first class is | ||
* processed by {@link #onMatchTopLevelClass(NullAway, ClassTree, VisitorState, | ||
* Symbol.ClassSymbol)} | ||
*/ | ||
@Initializer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just out of curiosity, was there any issue marking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, just annotating |
||
private void init(VisitorState state) { | ||
tbaseType = Optional.ofNullable(TBASE_TYPE_SUPPLIER.get(state)).map(state.getTypes()::erasure); | ||
} | ||
|
||
@Override | ||
public NullnessHint onDataflowVisitMethodInvocation( | ||
MethodInvocationNode node, | ||
|
@@ -173,7 +182,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") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing this change, I wonder if there is a way to define this version as a constant once in this yml and reference it in all these jobs and the check below, like we do inside gradle :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this is not possible. You can define variables in an
env
context but you can't use them when specifying properties in thematrix
, see here.