fix errors found by errorprone

This commit is contained in:
Christopher Lambert
2021-06-17 15:03:16 +02:00
parent dc1c6c5e82
commit 950b31fbae
61 changed files with 94 additions and 201 deletions

View File

@@ -75,13 +75,12 @@ public class DateRangeFunc implements LongFunction<DateRange> {
this.upper = upper;
}
@Override
public DateRange apply(long value) {
Date lowerDate = new Date(lower.applyAsLong(value));
DateRange.DateRangeBound lower = DateRange.DateRangeBound.lowerBound(lowerDate,precision);
Date upperDate = new Date(upper.applyAsLong(value));
DateRange.DateRangeBound upper = DateRange.DateRangeBound.upperBound(lowerDate,precision);
DateRange.DateRangeBound upper = DateRange.DateRangeBound.upperBound(upperDate,precision);
DateRange dateRange = new DateRange(lower, upper);
return dateRange;
}

View File

@@ -30,8 +30,6 @@ public class AvailableCQLStatements {
}
public List<CQLStatementDefParser> getMatching(String tagSpec) {
List<CQLStatementDefParser> defs = new ArrayList<>();
TagFilter ts = new TagFilter(tagSpec);
List<CQLStatementDefParser> CQLStatementDefParsers =
availableDefs.stream()

View File

@@ -320,7 +320,7 @@ public class CQLSessionCache implements Shutdownable {
Cluster cl = builder.build();
// Apply default idempotence, if set
activityDef.getParams().getOptionalBoolean("defaultidempotence").map(
activityDef.getParams().getOptionalBoolean("defaultidempotence").ifPresent(
b -> cl.getConfiguration().getQueryOptions().setDefaultIdempotence(b)
);

View File

@@ -12,30 +12,18 @@ public class CQLStatementDefParser {
private final static Logger logger = LogManager.getLogger(CQLStatementDefParser.class);
// private final static Pattern templateToken = Pattern.compile("<<(\\w+(:(.+?))?)>>");
private final static Pattern stmtToken = Pattern.compile("\\?(\\w+[-_\\d\\w]*)|\\{(\\w+[-_\\d\\w.]*)}");
private final static String UNSET_VALUE = "UNSET-VALUE";
private final String stmt;
private final String name;
private CQLStatementDef deprecatedDef; // deprecated, to be removed
public void setBindings(Map<String, String> bindings) {
this.bindings = bindings;
}
private Map<String, String> bindings;
public CQLStatementDef getDeprecatedDef() {
return deprecatedDef;
}
public void setDeprecatedDef(CQLStatementDef deprecatedDef) {
this.deprecatedDef = deprecatedDef;
}
public CQLStatementDefParser(String name, String stmt) {
this.stmt = stmt;
this.name = name;
this.bindings = bindings;
}
public Map<String,String> getBindings() {
@@ -122,6 +110,7 @@ public class CQLStatementDefParser {
this.missingGenerators = missingGenerators;
this.missingAnchors = missingAnchors;
this.statement = stmt;
this.bindings = bindings;
this.name = name;
}

View File

@@ -23,7 +23,7 @@ public enum DiffType {
/// the actual data.
all(0x1|0x1<<1|0x1<<2);
public int bitmask;
public final int bitmask;
DiffType(int bit) {
this.bitmask = bit;

View File

@@ -9,6 +9,7 @@ import java.nio.file.*;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.stream.Stream;
public class ParserForCqlTest {
@@ -37,15 +38,14 @@ public class ParserForCqlTest {
URL url = resources.nextElement();
System.out.println("url=" + url.toExternalForm());
Path path = Paths.get(url.toURI());
Files.walk(path, FileVisitOption.FOLLOW_LINKS)
.filter(p -> !Files.isDirectory(p, LinkOption.NOFOLLOW_LINKS))
.forEach(subpaths::add);
try (Stream<Path> fileStream = Files.walk(path, FileVisitOption.FOLLOW_LINKS)) {
fileStream.filter(p -> !Files.isDirectory(p, LinkOption.NOFOLLOW_LINKS))
.forEach(subpaths::add);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return subpaths;
}
}