Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package tech.picnic.errorprone.refasterrules;

import com.google.common.primitives.Booleans;
import com.google.common.primitives.Bytes;
import com.google.common.primitives.Chars;
import com.google.common.primitives.Doubles;
import com.google.common.primitives.Floats;
Expand Down Expand Up @@ -95,110 +93,6 @@ int after(long l) {
}
}

/** Prefer {@link Boolean#hashCode(boolean)} over the Guava alternative. */
static final class BooleanHashCode {
@BeforeTemplate
int before(boolean b) {
return Booleans.hashCode(b);
}

@AfterTemplate
int after(boolean b) {
return Boolean.hashCode(b);
}
}

/** Prefer {@link Byte#hashCode(byte)} over the Guava alternative. */
static final class ByteHashCode {
@BeforeTemplate
int before(byte b) {
return Bytes.hashCode(b);
}

@AfterTemplate
int after(byte b) {
return Byte.hashCode(b);
}
}

/** Prefer {@link Character#hashCode(char)} over the Guava alternative. */
static final class CharacterHashCode {
@BeforeTemplate
int before(char c) {
return Chars.hashCode(c);
}

@AfterTemplate
int after(char c) {
return Character.hashCode(c);
}
}

/** Prefer {@link Short#hashCode(short)} over the Guava alternative. */
static final class ShortHashCode {
@BeforeTemplate
int before(short s) {
return Shorts.hashCode(s);
}

@AfterTemplate
int after(short s) {
return Short.hashCode(s);
}
}

/** Prefer {@link Integer#hashCode(int)} over the Guava alternative. */
static final class IntegerHashCode {
@BeforeTemplate
int before(int i) {
return Ints.hashCode(i);
}

@AfterTemplate
int after(int i) {
return Integer.hashCode(i);
}
}

/** Prefer {@link Long#hashCode(long)} over the Guava alternative. */
static final class LongHashCode {
@BeforeTemplate
int before(long l) {
return Longs.hashCode(l);
}

@AfterTemplate
int after(long l) {
return Long.hashCode(l);
}
}

/** Prefer {@link Float#hashCode(float)} over the Guava alternative. */
static final class FloatHashCode {
@BeforeTemplate
int before(float f) {
return Floats.hashCode(f);
}

@AfterTemplate
int after(float f) {
return Float.hashCode(f);
}
}

/** Prefer {@link Double#hashCode(double)} over the Guava alternative. */
static final class DoubleHashCode {
@BeforeTemplate
int before(double d) {
return Doubles.hashCode(d);
}

@AfterTemplate
int after(double d) {
return Double.hashCode(d);
}
}

/** Prefer {@link Character#BYTES} over the Guava alternative. */
static final class CharacterBytes {
@BeforeTemplate
Expand Down Expand Up @@ -277,32 +171,6 @@ int after() {
}
}

/** Prefer {@link Float#isFinite(float)} over the Guava alternative. */
static final class FloatIsFinite {
@BeforeTemplate
boolean before(float f) {
return Floats.isFinite(f);
}

@AfterTemplate
boolean after(float f) {
return Float.isFinite(f);
}
}

/** Prefer {@link Double#isFinite(double)} over the Guava alternative. */
static final class DoubleIsFinite {
@BeforeTemplate
boolean before(double d) {
return Doubles.isFinite(d);
}

@AfterTemplate
boolean after(double d) {
return Double.isFinite(d);
}
}

/** Prefer an {@link Integer#signum(int)} comparison to 1 over less clear alternatives. */
static final class IntegerSignumIsPositive {
@BeforeTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,38 +80,6 @@ int testLongToIntExact() {
return Ints.checkedCast(Long.MAX_VALUE);
}

int testBooleanHashCode() {
return Booleans.hashCode(true);
}

int testByteHashCode() {
return Bytes.hashCode((byte) 1);
}

int testCharacterHashCode() {
return Chars.hashCode('a');
}

int testShortHashCode() {
return Shorts.hashCode((short) 1);
}

int testIntegerHashCode() {
return Ints.hashCode(1);
}

int testLongHashCode() {
return Longs.hashCode(1);
}

int testFloatHashCode() {
return Floats.hashCode(1);
}

int testDoubleHashCode() {
return Doubles.hashCode(1);
}

int testCharacterBytes() {
return Chars.BYTES;
}
Expand All @@ -136,14 +104,6 @@ int testDoubleBytes() {
return Doubles.BYTES;
}

boolean testFloatIsFinite() {
return Floats.isFinite(1);
}

boolean testDoubleIsFinite() {
return Doubles.isFinite(1);
}

ImmutableSet<Boolean> testIntegerSignumIsPositive() {
return ImmutableSet.of(
Integer.signum(1) > 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,6 @@ int testLongToIntExact() {
return Math.toIntExact(Long.MAX_VALUE);
}

int testBooleanHashCode() {
return Boolean.hashCode(true);
}

int testByteHashCode() {
return Byte.hashCode((byte) 1);
}

int testCharacterHashCode() {
return Character.hashCode('a');
}

int testShortHashCode() {
return Short.hashCode((short) 1);
}

int testIntegerHashCode() {
return Integer.hashCode(1);
}

int testLongHashCode() {
return Long.hashCode(1);
}

int testFloatHashCode() {
return Float.hashCode(1);
}

int testDoubleHashCode() {
return Double.hashCode(1);
}

int testCharacterBytes() {
return Character.BYTES;
}
Expand All @@ -137,14 +105,6 @@ int testDoubleBytes() {
return Double.BYTES;
}

boolean testFloatIsFinite() {
return Float.isFinite(1);
}

boolean testDoubleIsFinite() {
return Double.isFinite(1);
}

ImmutableSet<Boolean> testIntegerSignumIsPositive() {
return ImmutableSet.of(
Integer.signum(1) == 1,
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/metrics-init.patch
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>33.4.8-jre<!-- Renovate: com.google.guava:guava-bom --></version>
+ <version>33.5.0-jre<!-- Renovate: com.google.guava:guava-bom --></version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-bom</artifactId>
<version>33.4.8-jre</version>
<version>33.5.0-jre</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down