Skip to content

Commit

Permalink
Update to errorprone 2.21.1 (#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmdietl authored Sep 8, 2023
1 parent f905a5e commit 4628661
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ subprojects {
// * Temporarily comment out "-Werror" elsewhere in this file
// * Repeatedly run `./gradlew clean compileJava` and fix all errors
// * Uncomment "-Werror"
ext.errorproneVersion = '2.20.0'
ext.errorproneVersion = '2.21.1'
errorprone group: 'com.google.errorprone', name: 'error_prone_core', version: errorproneVersion

// TODO: it's a bug that annotatedlib:guava requires the error_prone_annotations dependency.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ private List<Symbol> getMethodSymbolsfor(
List<Symbol> result = new ArrayList<>();
ClassSymbol classSym = (ClassSymbol) sym;
while (classSym != null) {
for (Symbol s : classSym.getEnclosedElements()) {
for (Symbol s : getEnclosedElements(classSym)) {
// check all member methods
if (s.getKind() == ElementKind.METHOD) {
// Check for method name and number of arguments
Expand Down Expand Up @@ -568,11 +568,11 @@ private List<Symbol> getConstructorSymbolsfor(
}

// TODO: Should this be used instead of the below??
ElementFilter.constructorsIn(symClass.getEnclosedElements());
ElementFilter.constructorsIn(getEnclosedElements(symClass));

// The common case is probably that there is one constructor of the given parameter length.
List<Symbol> result = new ArrayList<>(2);
for (Symbol s : symClass.getEnclosedElements()) {
for (Symbol s : getEnclosedElements(symClass)) {
// Check all constructors
if (s.getKind() == ElementKind.CONSTRUCTOR) {
// Check for number of parameters
Expand Down Expand Up @@ -610,6 +610,18 @@ private Symbol getSymbol(String className, Env<AttrContext> env, Names names, Re
}
}

/**
* Determine the enclosed elements for an element. This wrapper is useful to avoid a signature
* change in the called method.
*
* @param sym the element
* @return the enclosed elements
*/
@SuppressWarnings("ASTHelpersSuggestions") // Use local helper.
private static List<Symbol> getEnclosedElements(Symbol sym) {
return sym.getEnclosedElements();
}

/**
* Build lub of the two types (represented by sets {@code set1} and {@code set2}) using the
* provided AnnotatedTypeFactory.
Expand Down

0 comments on commit 4628661

Please sign in to comment.