Skip to content

Commit

Permalink
Remove @CanIgnoreReturnValue from Interner.intern.
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 432345398
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Mar 4, 2022
1 parent 0333746 commit b0673d8
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class InternersBenchmark {
int weakInterner(int reps) {
Interner<String> interner = Interners.newWeakInterner();
for (int i = 0; i < reps; i++) {
interner.intern(Double.toHexString(Math.random()));
String unused = interner.intern(Double.toHexString(Math.random()));
}
return reps;
}
Expand All @@ -37,7 +37,7 @@ int weakInterner(int reps) {
int strongInterner(int reps) {
Interner<String> interner = Interners.newStrongInterner();
for (int i = 0; i < reps; i++) {
interner.intern(Double.toHexString(Math.random()));
String unused = interner.intern(Double.toHexString(Math.random()));
}
return reps;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public enum InternerImpl implements InternerImplEnum {
public <E> Interner<E> create(Collection<E> contents) {
Interner<E> interner = Interners.newWeakInterner();
for (E e : contents) {
interner.intern(e);
E unused = interner.intern(e);
}
return interner;
}
Expand All @@ -396,7 +396,7 @@ public <E> Interner<E> create(Collection<E> contents) {
public <E> Interner<E> create(Collection<E> contents) {
Interner<E> interner = Interners.newStrongInterner();
for (E e : contents) {
interner.intern(e);
E unused = interner.intern(e);
}
return interner;
}
Expand Down
2 changes: 0 additions & 2 deletions android/guava/src/com/google/common/collect/Interner.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.google.common.collect;

import com.google.common.annotations.GwtIncompatible;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.DoNotMock;

/**
Expand Down Expand Up @@ -47,6 +46,5 @@ public interface Interner<E> {
*
* @throws NullPointerException if {@code sample} is null
*/
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
E intern(E sample);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class InternersBenchmark {
int weakInterner(int reps) {
Interner<String> interner = Interners.newWeakInterner();
for (int i = 0; i < reps; i++) {
interner.intern(Double.toHexString(Math.random()));
String unused = interner.intern(Double.toHexString(Math.random()));
}
return reps;
}
Expand All @@ -37,7 +37,7 @@ int weakInterner(int reps) {
int strongInterner(int reps) {
Interner<String> interner = Interners.newStrongInterner();
for (int i = 0; i < reps; i++) {
interner.intern(Double.toHexString(Math.random()));
String unused = interner.intern(Double.toHexString(Math.random()));
}
return reps;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public enum InternerImpl implements InternerImplEnum {
public <E> Interner<E> create(Collection<E> contents) {
Interner<E> interner = Interners.newWeakInterner();
for (E e : contents) {
interner.intern(e);
E unused = interner.intern(e);
}
return interner;
}
Expand All @@ -396,7 +396,7 @@ public <E> Interner<E> create(Collection<E> contents) {
public <E> Interner<E> create(Collection<E> contents) {
Interner<E> interner = Interners.newStrongInterner();
for (E e : contents) {
interner.intern(e);
E unused = interner.intern(e);
}
return interner;
}
Expand Down
2 changes: 0 additions & 2 deletions guava/src/com/google/common/collect/Interner.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.google.common.collect;

import com.google.common.annotations.GwtIncompatible;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.DoNotMock;

/**
Expand Down Expand Up @@ -47,6 +46,5 @@ public interface Interner<E> {
*
* @throws NullPointerException if {@code sample} is null
*/
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
E intern(E sample);
}

0 comments on commit b0673d8

Please sign in to comment.