Skip to content

Commit

Permalink
Also switch the argument type of getKnownInitializers and refactor it
Browse files Browse the repository at this point in the history
  • Loading branch information
lazaroclapp committed May 13, 2022
1 parent ad57184 commit 2b4970b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions nullaway/src/main/java/com/uber/nullaway/AbstractConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.google.errorprone.util.ASTHelpers;
import com.sun.tools.javac.code.Symbol;
import com.uber.nullaway.fixserialization.FixSerializationConfig;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -292,15 +291,17 @@ public boolean isContractAnnotation(String annotationName) {
return contractAnnotations.contains(annotationName);
}

protected ImmutableSet<MethodClassAndName> getKnownInitializers(Set<String> qualifiedNames) {
Set<MethodClassAndName> result = new LinkedHashSet<>();
for (String name : qualifiedNames) {
int lastDot = name.lastIndexOf('.');
String methodName = name.substring(lastDot + 1);
String className = name.substring(0, lastDot);
result.add(MethodClassAndName.create(className, methodName));
}
return ImmutableSet.copyOf(result);
protected ImmutableSet<MethodClassAndName> getKnownInitializers(
ImmutableSet<String> qualifiedNames) {
return qualifiedNames.stream()
.map(
name -> {
int lastDot = name.lastIndexOf('.');
String methodName = name.substring(lastDot + 1);
String className = name.substring(0, lastDot);
return MethodClassAndName.create(className, methodName);
})
.collect(ImmutableSet.toImmutableSet());
}

@AutoValue
Expand Down

0 comments on commit 2b4970b

Please sign in to comment.