Skip to content

Commit

Permalink
Upgrade error-prone static analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Jan 17, 2021
1 parent 3ee6531 commit 9423f15
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,15 @@ public boolean equals(Object o) {
return false;
}
CaffeineSpec spec = (CaffeineSpec) o;
return Objects.equals(initialCapacity, spec.initialCapacity)
&& Objects.equals(maximumSize, spec.maximumSize)
&& Objects.equals(maximumWeight, spec.maximumWeight)
&& Objects.equals(keyStrength, spec.keyStrength)
&& Objects.equals(valueStrength, spec.valueStrength)
&& Objects.equals(recordStats, spec.recordStats)
&& Objects.equals(expireAfterWrite, spec.expireAfterWrite)
return Objects.equals(refreshAfterWrite, spec.refreshAfterWrite)
&& Objects.equals(expireAfterAccess, spec.expireAfterAccess)
&& Objects.equals(refreshAfterWrite, spec.refreshAfterWrite);
&& Objects.equals(expireAfterWrite, spec.expireAfterWrite)
&& (initialCapacity == spec.initialCapacity)
&& (maximumWeight == spec.maximumWeight)
&& (valueStrength == spec.valueStrength)
&& (keyStrength == spec.keyStrength)
&& (maximumSize == spec.maximumSize)
&& (recordStats == spec.recordStats);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public void async_nullLoader() {
}

@Test
@SuppressWarnings("UnnecessaryMethodReference")
public void async_asyncLoader() {
Caffeine.newBuilder().buildAsync(loader::asyncLoad);
}
Expand Down
5 changes: 5 additions & 0 deletions checksum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<trusted-key id='62ee8529396cdc00' group='com.clearspring.analytics' />
<trusted-key id='c9fbaa83a8753994' group='com.fasterxml.jackson.core' />
<trusted-key id='c9fbaa83a8753994' group='com.fasterxml.jackson.dataformat' />
<trusted-key id='07d3516820bcf6b1' group='com.github.ben-manes.caffeine' />
<trusted-key id='3c0a8f4744f37328' group='com.github.ben-manes.caffeine' />
<trusted-key id='935869efbf04b2a9' group='com.github.h908714124' />
<trusted-key id='53dfc5afe188b729' group='com.github.jbellis' />
Expand Down Expand Up @@ -92,6 +93,7 @@
<trusted-key id='a41f13c999945293' group='commons-logging' />
<trusted-key id='379ce192d401ab61' group='info.picocli' />
<trusted-key id='0d9cb5ee96b7bc22' group='io.airlift' />
<trusted-key id='a6ea2e2bf22e0543' group='io.github.java-diff-utils' />
<trusted-key id='94b291aef984a085' group='io.reactivex.rxjava3' />
<trusted-key id='5e2f2b3d474efe6b' group='it.unimi.dsi' />
<trusted-key id='823dba283a93ee3c' group='it.unimi.dsi' />
Expand Down Expand Up @@ -485,6 +487,9 @@
<sha512>A056FCE66EA9664D1CF22C64D948FE7BFB809253ABAB646EB6C9DFAA5B2894377D2E403A40B5F965C4BFDFA83EAC06F0CC9511CBFA7FA4E8DB3F3F0C59716CCD</sha512>
<sha512>AFC41AFD611214C500CACA4D826652E38D5DDD1BCF182D935AFFD2B5B8DF26650DFEB76E4C06C2D46593E1FB86BB4D093438E8E862666E64AB32FB4B6EFEA30D</sha512>
</dependency>
<dependency group='org.sonarsource.scanner.gradle' module='sonarqube-gradle-plugin' version='3.1'>
<sha512>EB7805D2B2321B4C0537C4BC228E2485EF374ED22F37001AAAA4790A983B6DE3642E19DFDF3ADECFC5921BAEA0FFBD092901955D8184AA67969C5B32A912108E</sha512>
</dependency>
<dependency group='org.testng' module='testng' version='7.0.0'>
<sha512>D31295F9998A446F62AE7BA9B7EE39A0F898D9B185047800920B72EE53632EC54A7BDD9E5BE4BB41EFAFE9D4C209DC4227CE6C9CC230301FE762875EFBC3F7C9</sha512>
</dependency>
Expand Down
14 changes: 7 additions & 7 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
*/
ext {
versions = [
akka: '2.6.10',
akka: '2.6.11',
cache2k: '2.1.1.Alpha',
checkerFramework: '3.8.0',
checkerFramework: '3.9.1',
coherence: '20.06',
collision: '0.3.3',
commonsCompress: '1.20',
Expand All @@ -36,9 +36,9 @@ ext {
concurrentlinkedhashmap: '1.4.2',
config: '1.4.1',
ehcache3: '3.9.0',
errorprone: '2.4.0',
errorprone: '2.5.1',
errorproneJavac: '9+181-r4173-1',
elasticSearch: '7.10.1',
elasticSearch: '7.10.2',
expiringMap: '0.5.9',
fastfilter: 'bf0b02297f',
fastutil: '8.4.4',
Expand All @@ -54,7 +54,7 @@ ext {
jmh: '1.27',
joor: '0.9.13',
jsr330: '1',
nullaway: '0.7.9',
nullaway: '0.8.0',
ohc: '0.6.1',
osgiComponentAnnotations: '1.4.0',
picocli: '4.6.1',
Expand All @@ -73,7 +73,7 @@ ext {
jcacheTck: '1.1.1',
jctools: '3.2.0',
junit: '4.13.1',
mockito: '3.6.28',
mockito: '3.7.7',
paxExam: '4.13.4',
testng: '7.3.0',
truth: '0.24',
Expand All @@ -96,7 +96,7 @@ ext {
pmd: '6.30.0',
semanticVersioning: '1.1.0',
shadow: '6.1.0',
sonarqube: '3.0',
sonarqube: '3.1',
spotbugs: '4.2.0',
spotbugsPlugin: '4.6.0',
stats: '0.2.2',
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-rc-4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 2 additions & 2 deletions guava/src/test/java/jsr166/JSR166TestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@
*
* </ul>
*/
@SuppressWarnings({"deprecation", "rawtypes", "serial",
"AssertionFailureIgnored", "DeprecatedThreadMethods", "JdkObsolete", "ThreadPriorityCheck"})
@SuppressWarnings({"deprecation", "rawtypes", "serial", "AssertionFailureIgnored",
"DeprecatedThreadMethods", "JdkObsolete", "JavaUtilDate", "ThreadPriorityCheck"})
public class JSR166TestCase extends TestCase {
private static final boolean useSecurityManager =
Boolean.getBoolean("jsr166.useSecurityManager");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ public void close() {
* @param outer the outermost error, or null if unset
* @return the outermost error, or null if unset and successful
*/
private static @Nullable Throwable tryClose(Object o, @Nullable Throwable outer) {
private static @Nullable Throwable tryClose(@Nullable Object o, @Nullable Throwable outer) {
if (o instanceof Closeable) {
try {
((Closeable) o).close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
*
* @author [email protected] (Ben Manes)
*/
@SuppressWarnings("JdkObsolete")
@SuppressWarnings({"JdkObsolete", "JavaUtilDate"})
public abstract class AbstractCopier<A> implements Copier {
private static final Map<Class<?>, Function<Object, Object>> JAVA_DEEP_COPY;
private static final Set<Class<?>> JAVA_IMMUTABLE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ protected byte[] serialize(Object object) {
}

@Override
@SuppressWarnings("BanSerializableRead")
protected Object deserialize(byte[] data, ClassLoader classLoader) {
try (InputStream bytes = new ByteArrayInputStream(data);
ObjectInputStream input = new ClassLoaderAwareObjectInputStream(bytes, classLoader)) {
Expand All @@ -89,6 +90,7 @@ protected ClassLoader getClassLoader() {
}

@Override
@SuppressWarnings("BanSerializableRead")
protected Class<?> resolveClass(ObjectStreamClass desc)
throws IOException, ClassNotFoundException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ public void immutable() {
}

@Test
@SuppressWarnings("JdkObsolete")
@SuppressWarnings({"JdkObsolete", "JavaUtilDate"})
public void deepCopy_date() {
Date date = new Date();
assertThat(copy(date), is(equalTo(date)));
}

@Test
@SuppressWarnings("JdkObsolete")
@SuppressWarnings({"JdkObsolete", "JavaUtilDate"})
public void deepCopy_calendar() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private AccessEvent(long key) {
}

/** Returns the key. */
public Long key() {
public long key() {
return key;
}

Expand Down Expand Up @@ -66,10 +66,10 @@ public boolean equals(Object o) {
return false;
}
AccessEvent event = (AccessEvent) o;
return Objects.equals(key(), event.key())
&& Objects.equals(weight(), event.weight())
&& Objects.equals(hitPenalty(), event.hitPenalty())
&& Objects.equals(missPenalty(), event.missPenalty());
return (key() == event.key())
&& (weight() == event.weight())
&& (hitPenalty() == event.hitPenalty())
&& (missPenalty() == event.missPenalty());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public void record(AccessEvent event) {

tick++;
recorder.add(event);
IntPriorityQueue times = accessTimes.get(event.key().longValue());
IntPriorityQueue times = accessTimes.get(event.key());
if (times == null) {
times = new IntArrayFIFOQueue();
accessTimes.put(event.key().longValue(), times);
accessTimes.put(event.key(), times);
}
times.enqueue(tick);
}
Expand Down Expand Up @@ -133,7 +133,7 @@ private final class KeyOnlyRecorder implements Recorder {
future = new LongArrayFIFOQueue(maximumSize);
}
@Override public void add(AccessEvent event) {
future.enqueue(event.key().longValue());
future.enqueue(event.key());
}
@Override public void process() {
while (!future.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public PolicyStats stats() {
@Override
public void record(AccessEvent event) {
policyStats.recordOperation();
if (data.add(event.key().longValue())) {
if (data.add(event.key())) {
policyStats.recordWeightedMiss(event.weight());
} else {
policyStats.recordWeightedHit(event.weight());
Expand Down

0 comments on commit 9423f15

Please sign in to comment.