Merge pull request #336 from XN137/fix-errorprone-errors

fix errors found by errorprone
This commit is contained in:
Jonathan Shook
2021-06-17 11:32:23 -05:00
committed by GitHub
61 changed files with 94 additions and 201 deletions
@@ -48,8 +48,6 @@ public class FunctionManifestProcessor extends AbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
List<Element> ts = new ArrayList<>();
try {
if (writer==null) {
writer = filer.createResource(StandardLocation.CLASS_OUTPUT, "", "META-INF/functions")
@@ -24,10 +24,10 @@ public enum FunctionType {
R_T(Function.class, Object.class, Object.class);
private final Class<?> functionClass;
private Class<?> inputClass;
private Class<?> returnClass;
private ValueType returnValueType;
private ValueType inputValueType;
private final Class<?> inputClass;
private final Class<?> returnClass;
private final ValueType returnValueType;
private final ValueType inputValueType;
FunctionType(Class<?> functionClass, Class<?> inputClass, Class<?> returnClass) {
this.functionClass = functionClass;
@@ -29,7 +29,7 @@ public enum ValueType implements Comparator<ValueType> {
OBJECT(Object.class, 8);
private final Class<?> clazz;
private int precedence;
private final int precedence;
ValueType(Class<?> clazz, int precedence) {
this.clazz = clazz;
@@ -30,6 +30,11 @@ public class BindPoint {
return Objects.equals(bindspec, bindPoint.bindspec);
}
@Override
public int hashCode() {
return Objects.hash(anchor, bindspec);
}
@Override
public String toString() {
return "BindPoint{" +
@@ -13,10 +13,9 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class ParsedTemplateTest {
private final Map<String, String> bindings = new HashMap<>() {{
put("bindname1", "bindspec1");
put("bindname2", "bindspec2");
}};
private final Map<String, String> bindings = Map.of(
"bindname1", "bindspec1",
"bindname2", "bindspec2");
private final String rawNothing = "This has no anchors";
private final String oneCurly = "A {curly} brace.";
private final String oneQuestion = " A ?question anchor.";
@@ -35,7 +34,7 @@ public class ParsedTemplateTest {
public void testShoudlMatchCurlyBraces() {
ParsedTemplate pt = new ParsedTemplate(oneCurly, bindings);
assertThat(pt.getSpans()).containsExactly("A ", "curly", " brace.");
assertThat(pt.getSpecificBindings().isEmpty());
assertThat(pt.getSpecificBindings()).isEmpty();
assertThat(pt.getMissingBindings()).contains("curly");
assertThat(pt.getExtraBindings()).hasSameElementsAs(bindings.keySet());
}