diff --git a/guava/pom.xml b/guava/pom.xml index f06ceb95767b..7a20f68ff9d9 100644 --- a/guava/pom.xml +++ b/guava/pom.xml @@ -160,7 +160,7 @@ -AsuppressWarnings=${checkerframework.suppress} -XDignore.symbol.file - -AuseDefaultsForUncheckedCode=source,bytecode + -AuseConservativeDefaultsForUncheckedCode=-source,-bytecode -AshowSuppressWarningsStrings -AwarnUnneededSuppressions @@ -385,14 +385,14 @@ checker-qual 0.0.0 system - ${CHECKERFRAMEWORK}/checker/dist/checker-qual.jar + /Users/aosenxiong/waterloo/eisop/checker-framework/checker/dist/checker-qual.jar io.github.eisop checker 0.0.0 system - ${CHECKERFRAMEWORK}/checker/dist/checker.jar + /Users/aosenxiong/waterloo/eisop/checker-framework/checker/dist/checker.jar diff --git a/guava/src/com/google/common/base/Ascii.java b/guava/src/com/google/common/base/Ascii.java index d5d1266a9cff..c4ac70ac09a1 100644 --- a/guava/src/com/google/common/base/Ascii.java +++ b/guava/src/com/google/common/base/Ascii.java @@ -39,6 +39,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Ascii { private Ascii() {} diff --git a/guava/src/com/google/common/base/CharMatcher.java b/guava/src/com/google/common/base/CharMatcher.java index 1dbdf5ea8403..9d78f13ddd3a 100644 --- a/guava/src/com/google/common/base/CharMatcher.java +++ b/guava/src/com/google/common/base/CharMatcher.java @@ -23,6 +23,7 @@ import com.google.common.annotations.VisibleForTesting; import java.util.Arrays; import java.util.BitSet; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.index.qual.GTENegativeOne; import org.checkerframework.checker.index.qual.IndexOrHigh; import org.checkerframework.checker.index.qual.IndexOrLow; @@ -69,6 +70,7 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class CharMatcher implements Predicate { /* * N777777777NO @@ -320,7 +322,7 @@ public static CharMatcher isNot(final char match) { * The CharSequence is not mutated, therefore after checking its length, * accesses to lower indices are safe. */ - public static CharMatcher anyOf(final CharSequence sequence) { + public static CharMatcher anyOf(final @Readonly CharSequence sequence) { switch (sequence.length()) { case 0: return none(); @@ -339,7 +341,7 @@ public static CharMatcher anyOf(final CharSequence sequence) { * Returns a {@code char} matcher that matches any BMP character not present in the given * character sequence. Returns a bogus matcher if the sequence contains supplementary characters. */ - public static CharMatcher noneOf(CharSequence sequence) { + public static CharMatcher noneOf(@Readonly CharSequence sequence) { return anyOf(sequence).negate(); } @@ -503,7 +505,7 @@ void setBits(BitSet table) { * @return {@code true} if this matcher matches at least one character in the sequence * @since 8.0 */ - public boolean matchesAnyOf(CharSequence sequence) { + public boolean matchesAnyOf(@Readonly CharSequence sequence) { return !matchesNoneOf(sequence); } @@ -517,7 +519,7 @@ public boolean matchesAnyOf(CharSequence sequence) { * @return {@code true} if this matcher matches every character in the sequence, including when * the sequence is empty */ - public boolean matchesAllOf(CharSequence sequence) { + public boolean matchesAllOf(@Readonly CharSequence sequence) { for (int i = sequence.length() - 1; i >= 0; i--) { if (!matches(sequence.charAt(i))) { return false; @@ -537,7 +539,7 @@ public boolean matchesAllOf(CharSequence sequence) { * @return {@code true} if this matcher matches no characters in the sequence, including when the * sequence is empty */ - public boolean matchesNoneOf(CharSequence sequence) { + public boolean matchesNoneOf(@Readonly CharSequence sequence) { return indexIn(sequence) == -1; } @@ -551,7 +553,7 @@ public boolean matchesNoneOf(CharSequence sequence) { * @param sequence the character sequence to examine from the beginning * @return an index, or {@code -1} if no character matches */ - public @IndexOrLow("#1") int indexIn(CharSequence sequence) { + public @IndexOrLow("#1") int indexIn(@Readonly CharSequence sequence) { return indexIn(sequence, 0); } @@ -570,7 +572,7 @@ public boolean matchesNoneOf(CharSequence sequence) { * @throws IndexOutOfBoundsException if start is negative or greater than {@code * sequence.length()} */ - public @IndexOrLow("#1") int indexIn(CharSequence sequence, @IndexOrHigh("#1") int start) { + public @IndexOrLow("#1") int indexIn(@Readonly CharSequence sequence, @IndexOrHigh("#1") int start) { int length = sequence.length(); checkPositionIndex(start, length); for (int i = start; i < length; i++) { @@ -591,7 +593,7 @@ public boolean matchesNoneOf(CharSequence sequence) { * @param sequence the character sequence to examine from the end * @return an index, or {@code -1} if no character matches */ - public @IndexOrLow("#1") int lastIndexIn(CharSequence sequence) { + public @IndexOrLow("#1") int lastIndexIn(@Readonly CharSequence sequence) { for (int i = sequence.length() - 1; i >= 0; i--) { if (matches(sequence.charAt(i))) { return i; @@ -608,7 +610,7 @@ public boolean matchesNoneOf(CharSequence sequence) { /* * count is incremented at most sequence.length() times */ - public @IndexOrHigh("#1") int countIn(CharSequence sequence) { + public @IndexOrHigh("#1") int countIn(@Readonly CharSequence sequence) { @IndexOrHigh("#1") int count = 0; for (int i = 0; i < sequence.length(); i++) { if (matches(sequence.charAt(i))) { @@ -628,7 +630,7 @@ public boolean matchesNoneOf(CharSequence sequence) { * * ... returns {@code "bzr"}. */ - public String removeFrom(CharSequence sequence) { + public String removeFrom(@Readonly CharSequence sequence) { String string = sequence.toString(); @GTENegativeOne @LTEqLengthOf("string") int pos = indexIn(string); if (pos == -1) { @@ -667,7 +669,7 @@ public String removeFrom(CharSequence sequence) { * * ... returns {@code "aaa"}. */ - public String retainFrom(CharSequence sequence) { + public String retainFrom(@Readonly CharSequence sequence) { return negate().removeFrom(sequence); } @@ -690,7 +692,7 @@ public String retainFrom(CharSequence sequence) { * character in {@code sequence} * @return the new string */ - public String replaceFrom(CharSequence sequence, char replacement) { + public String replaceFrom(@Readonly CharSequence sequence, char replacement) { String string = sequence.toString(); int pos = indexIn(string); if (pos == -1) { @@ -729,7 +731,7 @@ public String replaceFrom(CharSequence sequence, char replacement) { * replacementLen should be @IndexOrHigh("replacement") * indexIn should return @IndexOrLow("#1") */ - public String replaceFrom(CharSequence sequence, CharSequence replacement) { + public String replaceFrom(@Readonly CharSequence sequence, @Readonly CharSequence replacement) { int replacementLen = replacement.length(); if (replacementLen == 0) { return removeFrom(sequence); @@ -777,7 +779,7 @@ public String replaceFrom(CharSequence sequence, CharSequence replacement) { * * ... is equivalent to {@link String#trim()}. */ - public String trimFrom(CharSequence sequence) { + public String trimFrom(@Readonly CharSequence sequence) { int len = sequence.length(); @IndexOrHigh("sequence") int first; int last; @@ -806,7 +808,7 @@ public String trimFrom(CharSequence sequence) { * * ... returns {@code "catbab"}. */ - public String trimLeadingFrom(CharSequence sequence) { + public String trimLeadingFrom(@Readonly CharSequence sequence) { int len = sequence.length(); for (int first = 0; first < len; first++) { if (!matches(sequence.charAt(first))) { @@ -826,7 +828,7 @@ public String trimLeadingFrom(CharSequence sequence) { * * ... returns {@code "abacat"}. */ - public String trimTrailingFrom(CharSequence sequence) { + public String trimTrailingFrom(@Readonly CharSequence sequence) { int len = sequence.length(); for (int last = len - 1; last >= 0; last--) { if (!matches(sequence.charAt(last))) { diff --git a/guava/src/com/google/common/base/Equivalence.java b/guava/src/com/google/common/base/Equivalence.java index 12228dfb2527..cbdb0db24482 100644 --- a/guava/src/com/google/common/base/Equivalence.java +++ b/guava/src/com/google/common/base/Equivalence.java @@ -22,6 +22,7 @@ import java.util.function.BiPredicate; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -41,6 +42,7 @@ * The type parameter is rather than so that we can use T in the * doEquivalent and doHash methods to indicate that the parameter cannot be null. */ +@SuppressWarnings("pico") public abstract class Equivalence implements BiPredicate<@Nullable T, @Nullable T> { /** Constructor for use by subclasses. */ protected Equivalence() {} @@ -363,7 +365,7 @@ public String toString() { * @since 8.0 (in Equivalences with null-friendly behavior) * @since 4.0 (in Equivalences) */ - public static Equivalence equals() { + public static Equivalence<@Readonly Object> equals() { return Equals.INSTANCE; } diff --git a/guava/src/com/google/common/base/Function.java b/guava/src/com/google/common/base/Function.java index caa74141215e..5eff57dae235 100644 --- a/guava/src/com/google/common/base/Function.java +++ b/guava/src/com/google/common/base/Function.java @@ -18,6 +18,8 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -46,7 +48,8 @@ @AnnotatedFor({"nullness"}) @FunctionalInterface @ElementTypesAreNonnullByDefault -public interface Function +@ReceiverDependentMutable +public interface Function extends java.util.function.Function { @Override @CanIgnoreReturnValue // TODO(kevinb): remove this @@ -66,5 +69,5 @@ public interface Function T firstNonNull(@CheckForNull T first, T second) { * class name * @since 18.0 (since 2.0 as {@code Objects.toStringHelper()}). */ - public static ToStringHelper toStringHelper(Object self) { + public static ToStringHelper toStringHelper(@Readonly Object self) { return new ToStringHelper(self.getClass().getSimpleName()); } @@ -350,7 +351,7 @@ public ToStringHelper addValue(long value) { return addUnconditionalHolder(String.valueOf(value)); } - private static boolean isEmpty(Object value) { + private static boolean isEmpty(@Readonly Object value) { // Put types estimated to be most frequent first. if (value instanceof CharSequence) { return ((CharSequence) value).length() == 0; @@ -421,13 +422,13 @@ private ValueHolder addHolder() { return valueHolder; } - private ToStringHelper addHolder(@CheckForNull Object value) { + private ToStringHelper addHolder(@CheckForNull @Readonly Object value) { ValueHolder valueHolder = addHolder(); valueHolder.value = value; return this; } - private ToStringHelper addHolder(String name, @CheckForNull Object value) { + private ToStringHelper addHolder(String name, @CheckForNull @Readonly Object value) { ValueHolder valueHolder = addHolder(); valueHolder.value = value; valueHolder.name = checkNotNull(name); @@ -440,13 +441,13 @@ private UnconditionalValueHolder addUnconditionalHolder() { return valueHolder; } - private ToStringHelper addUnconditionalHolder(Object value) { + private ToStringHelper addUnconditionalHolder(@Readonly Object value) { UnconditionalValueHolder valueHolder = addUnconditionalHolder(); valueHolder.value = value; return this; } - private ToStringHelper addUnconditionalHolder(String name, Object value) { + private ToStringHelper addUnconditionalHolder(String name, @Readonly Object value) { UnconditionalValueHolder valueHolder = addUnconditionalHolder(); valueHolder.value = value; valueHolder.name = checkNotNull(name); @@ -456,7 +457,7 @@ private ToStringHelper addUnconditionalHolder(String name, Object value) { // Holder object for values that might be null and/or empty. private static class ValueHolder { @CheckForNull String name; - @CheckForNull Object value; + @CheckForNull @Readonly Object value; @CheckForNull ValueHolder next; } diff --git a/guava/src/com/google/common/base/Objects.java b/guava/src/com/google/common/base/Objects.java index 13bc37f797a1..8b05a0da1ad4 100644 --- a/guava/src/com/google/common/base/Objects.java +++ b/guava/src/com/google/common/base/Objects.java @@ -18,6 +18,7 @@ import java.util.Arrays; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -54,7 +55,7 @@ private Objects() {} *

Note for Java 7 and later: This method should be treated as deprecated; use {@link * java.util.Objects#equals} instead. */ - public static boolean equal(@CheckForNull @PolySigned Object a, @CheckForNull @PolySigned Object b) { + public static boolean equal(@CheckForNull @PolySigned @Readonly Object a, @CheckForNull @PolySigned @Readonly Object b) { return a == b || (a != null && a.equals(b)); } @@ -80,7 +81,7 @@ public static boolean equal(@CheckForNull @PolySigned Object a, @CheckForNull @P * java.util.Objects#hash} instead. */ @Pure - public static int hashCode(@CheckForNull @Nullable Object... objects) { + public static int hashCode(@CheckForNull @Nullable @Readonly Object @Readonly ... objects) { return Arrays.hashCode(objects); } } diff --git a/guava/src/com/google/common/base/Optional.java b/guava/src/com/google/common/base/Optional.java index 8700b4977b55..ad69f2d7e15c 100644 --- a/guava/src/com/google/common/base/Optional.java +++ b/guava/src/com/google/common/base/Optional.java @@ -91,6 +91,7 @@ @DoNotMock("Use Optional.of(value) or Optional.absent()") @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class Optional implements Serializable { /** * Returns an {@code Optional} instance with no contained reference. diff --git a/guava/src/com/google/common/base/Preconditions.java b/guava/src/com/google/common/base/Preconditions.java index 9205fcbee305..63655cb1813d 100644 --- a/guava/src/com/google/common/base/Preconditions.java +++ b/guava/src/com/google/common/base/Preconditions.java @@ -23,6 +23,7 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.dataflow.qual.AssertMethod; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -151,7 +152,7 @@ public static void checkArgument(boolean expression) { */ @AssertMethod(IllegalArgumentException.class) @Pure - public static void checkArgument(boolean expression, @CheckForNull Object errorMessage) { + public static void checkArgument(boolean expression, @CheckForNull @Readonly Object errorMessage) { if (!expression) { throw new IllegalArgumentException(String.valueOf(errorMessage)); } @@ -175,7 +176,7 @@ public static void checkArgument(boolean expression, @CheckForNull Object errorM public static void checkArgument( boolean expression, String errorMessageTemplate, - @CheckForNull @Nullable Object... errorMessageArgs) { + @CheckForNull @Nullable @Readonly Object... errorMessageArgs) { if (!expression) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, errorMessageArgs)); } @@ -236,7 +237,7 @@ public static void checkArgument(boolean b, String errorMessageTemplate, long p1 @AssertMethod(IllegalArgumentException.class) @Pure public static void checkArgument( - boolean b, String errorMessageTemplate, @CheckForNull Object p1) { + boolean b, String errorMessageTemplate, @CheckForNull @Readonly Object p1) { if (!b) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, p1)); } @@ -297,7 +298,7 @@ public static void checkArgument(boolean b, String errorMessageTemplate, char p1 @AssertMethod(IllegalArgumentException.class) @Pure public static void checkArgument( - boolean b, String errorMessageTemplate, char p1, @CheckForNull Object p2) { + boolean b, String errorMessageTemplate, char p1, @CheckForNull @Readonly Object p2) { if (!b) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -358,7 +359,7 @@ public static void checkArgument(boolean b, String errorMessageTemplate, int p1, @AssertMethod(IllegalArgumentException.class) @Pure public static void checkArgument( - boolean b, String errorMessageTemplate, int p1, @CheckForNull Object p2) { + boolean b, String errorMessageTemplate, int p1, @CheckForNull @Readonly Object p2) { if (!b) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -419,7 +420,7 @@ public static void checkArgument(boolean b, String errorMessageTemplate, long p1 @AssertMethod(IllegalArgumentException.class) @Pure public static void checkArgument( - boolean b, String errorMessageTemplate, long p1, @CheckForNull Object p2) { + boolean b, String errorMessageTemplate, long p1, @CheckForNull @Readonly Object p2) { if (!b) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -435,7 +436,7 @@ public static void checkArgument( @AssertMethod(IllegalArgumentException.class) @Pure public static void checkArgument( - boolean b, String errorMessageTemplate, @CheckForNull Object p1, char p2) { + boolean b, String errorMessageTemplate, @CheckForNull @Readonly Object p1, char p2) { if (!b) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -451,7 +452,7 @@ public static void checkArgument( @AssertMethod(IllegalArgumentException.class) @Pure public static void checkArgument( - boolean b, String errorMessageTemplate, @CheckForNull Object p1, int p2) { + boolean b, String errorMessageTemplate, @CheckForNull @Readonly Object p1, int p2) { if (!b) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -467,7 +468,7 @@ public static void checkArgument( @AssertMethod(IllegalArgumentException.class) @Pure public static void checkArgument( - boolean b, String errorMessageTemplate, @CheckForNull Object p1, long p2) { + boolean b, String errorMessageTemplate, @CheckForNull @Readonly Object p1, long p2) { if (!b) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -483,7 +484,7 @@ public static void checkArgument( @AssertMethod(IllegalArgumentException.class) @Pure public static void checkArgument( - boolean b, String errorMessageTemplate, @CheckForNull Object p1, @CheckForNull Object p2) { + boolean b, String errorMessageTemplate, @CheckForNull @Readonly Object p1, @CheckForNull @Readonly Object p2) { if (!b) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -501,9 +502,9 @@ public static void checkArgument( public static void checkArgument( boolean b, String errorMessageTemplate, - @CheckForNull Object p1, - @CheckForNull Object p2, - @CheckForNull Object p3) { + @CheckForNull @Readonly Object p1, + @CheckForNull @Readonly Object p2, + @CheckForNull @Readonly Object p3) { if (!b) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, p1, p2, p3)); } @@ -521,10 +522,10 @@ public static void checkArgument( public static void checkArgument( boolean b, String errorMessageTemplate, - @CheckForNull Object p1, - @CheckForNull Object p2, - @CheckForNull Object p3, - @CheckForNull Object p4) { + @CheckForNull @Readonly Object p1, + @CheckForNull @Readonly Object p2, + @CheckForNull @Readonly Object p3, + @CheckForNull @Readonly Object p4) { if (!b) { throw new IllegalArgumentException(lenientFormat(errorMessageTemplate, p1, p2, p3, p4)); } @@ -558,7 +559,7 @@ public static void checkState(boolean expression) { */ @AssertMethod(IllegalStateException.class) @Pure - public static void checkState(boolean expression, @CheckForNull Object errorMessage) { + public static void checkState(boolean expression, @CheckForNull @Readonly Object errorMessage) { if (!expression) { throw new IllegalStateException(String.valueOf(errorMessage)); } @@ -592,7 +593,7 @@ public static void checkState( * that user first. */ @CheckForNull String errorMessageTemplate, - @CheckForNull @Nullable Object... errorMessageArgs) { + @CheckForNull @Nullable @Readonly Object... errorMessageArgs) { if (!expression) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, errorMessageArgs)); } @@ -656,7 +657,7 @@ public static void checkState(boolean b, String errorMessageTemplate, long p1) { */ @AssertMethod(IllegalStateException.class) @Pure - public static void checkState(boolean b, String errorMessageTemplate, @CheckForNull Object p1) { + public static void checkState(boolean b, String errorMessageTemplate, @CheckForNull @Readonly Object p1) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1)); } @@ -721,7 +722,7 @@ public static void checkState(boolean b, String errorMessageTemplate, char p1, l @AssertMethod(IllegalStateException.class) @Pure public static void checkState( - boolean b, String errorMessageTemplate, char p1, @CheckForNull Object p2) { + boolean b, String errorMessageTemplate, char p1, @CheckForNull @Readonly Object p2) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -786,7 +787,7 @@ public static void checkState(boolean b, String errorMessageTemplate, int p1, lo @AssertMethod(IllegalStateException.class) @Pure public static void checkState( - boolean b, String errorMessageTemplate, int p1, @CheckForNull Object p2) { + boolean b, String errorMessageTemplate, int p1, @CheckForNull @Readonly Object p2) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -851,7 +852,7 @@ public static void checkState(boolean b, String errorMessageTemplate, long p1, l @AssertMethod(IllegalStateException.class) @Pure public static void checkState( - boolean b, String errorMessageTemplate, long p1, @CheckForNull Object p2) { + boolean b, String errorMessageTemplate, long p1, @CheckForNull @Readonly Object p2) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -868,7 +869,7 @@ public static void checkState( @AssertMethod(IllegalStateException.class) @Pure public static void checkState( - boolean b, String errorMessageTemplate, @CheckForNull Object p1, char p2) { + boolean b, String errorMessageTemplate, @CheckForNull @Readonly Object p1, char p2) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -885,7 +886,7 @@ public static void checkState( @AssertMethod(IllegalStateException.class) @Pure public static void checkState( - boolean b, String errorMessageTemplate, @CheckForNull Object p1, int p2) { + boolean b, String errorMessageTemplate, @CheckForNull @Readonly Object p1, int p2) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -902,7 +903,7 @@ public static void checkState( @AssertMethod(IllegalStateException.class) @Pure public static void checkState( - boolean b, String errorMessageTemplate, @CheckForNull Object p1, long p2) { + boolean b, String errorMessageTemplate, @CheckForNull @Readonly Object p1, long p2) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -919,7 +920,7 @@ public static void checkState( @AssertMethod(IllegalStateException.class) @Pure public static void checkState( - boolean b, String errorMessageTemplate, @CheckForNull Object p1, @CheckForNull Object p2) { + boolean b, String errorMessageTemplate, @CheckForNull @Readonly Object p1, @CheckForNull @Readonly Object p2) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -938,9 +939,9 @@ public static void checkState( public static void checkState( boolean b, String errorMessageTemplate, - @CheckForNull Object p1, - @CheckForNull Object p2, - @CheckForNull Object p3) { + @CheckForNull @Readonly Object p1, + @CheckForNull @Readonly Object p2, + @CheckForNull @Readonly Object p3) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2, p3)); } @@ -959,10 +960,10 @@ public static void checkState( public static void checkState( boolean b, String errorMessageTemplate, - @CheckForNull Object p1, - @CheckForNull Object p2, - @CheckForNull Object p3, - @CheckForNull Object p4) { + @CheckForNull @Readonly Object p1, + @CheckForNull @Readonly Object p2, + @CheckForNull @Readonly Object p3, + @CheckForNull @Readonly Object p4) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2, p3, p4)); } @@ -1011,7 +1012,7 @@ public static T checkNotNull(@CheckForNull T reference) { */ @CanIgnoreReturnValue @Pure - public static T checkNotNull(@CheckForNull T reference, @CheckForNull Object errorMessage) { + public static T checkNotNull(@CheckForNull T reference, @CheckForNull @Readonly Object errorMessage) { if (reference == null) { throw new NullPointerException(String.valueOf(errorMessage)); } @@ -1038,7 +1039,7 @@ public static T checkNotNull(@CheckForNull T reference, @CheckForNull Object public static T checkNotNull( @CheckForNull T reference, String errorMessageTemplate, - @CheckForNull @Nullable Object... errorMessageArgs) { + @CheckForNull @Nullable @Readonly Object... errorMessageArgs) { if (reference == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, errorMessageArgs)); } @@ -1103,7 +1104,7 @@ public static T checkNotNull(@CheckForNull T obj, String errorMessageTemplat @CanIgnoreReturnValue @Pure public static T checkNotNull( - @CheckForNull T obj, String errorMessageTemplate, @CheckForNull Object p1) { + @CheckForNull T obj, String errorMessageTemplate, @CheckForNull @Readonly Object p1) { if (obj == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, p1)); } @@ -1171,7 +1172,7 @@ public static T checkNotNull( @CanIgnoreReturnValue @Pure public static T checkNotNull( - @CheckForNull T obj, String errorMessageTemplate, char p1, @CheckForNull Object p2) { + @CheckForNull T obj, String errorMessageTemplate, char p1, @CheckForNull @Readonly Object p2) { if (obj == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -1239,7 +1240,7 @@ public static T checkNotNull( @CanIgnoreReturnValue @Pure public static T checkNotNull( - @CheckForNull T obj, String errorMessageTemplate, int p1, @CheckForNull Object p2) { + @CheckForNull T obj, String errorMessageTemplate, int p1, @CheckForNull @Readonly Object p2) { if (obj == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -1307,7 +1308,7 @@ public static T checkNotNull( @CanIgnoreReturnValue @Pure public static T checkNotNull( - @CheckForNull T obj, String errorMessageTemplate, long p1, @CheckForNull Object p2) { + @CheckForNull T obj, String errorMessageTemplate, long p1, @CheckForNull @Readonly Object p2) { if (obj == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -1324,7 +1325,7 @@ public static T checkNotNull( @CanIgnoreReturnValue @Pure public static T checkNotNull( - @CheckForNull T obj, String errorMessageTemplate, @CheckForNull Object p1, char p2) { + @CheckForNull T obj, String errorMessageTemplate, @CheckForNull @Readonly Object p1, char p2) { if (obj == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -1341,7 +1342,7 @@ public static T checkNotNull( @CanIgnoreReturnValue @Pure public static T checkNotNull( - @CheckForNull T obj, String errorMessageTemplate, @CheckForNull Object p1, int p2) { + @CheckForNull T obj, String errorMessageTemplate, @CheckForNull @Readonly Object p1, int p2) { if (obj == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -1358,7 +1359,7 @@ public static T checkNotNull( @CanIgnoreReturnValue @Pure public static T checkNotNull( - @CheckForNull T obj, String errorMessageTemplate, @CheckForNull Object p1, long p2) { + @CheckForNull T obj, String errorMessageTemplate, @CheckForNull @Readonly Object p1, long p2) { if (obj == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -1377,8 +1378,8 @@ public static T checkNotNull( public static T checkNotNull( @CheckForNull T obj, String errorMessageTemplate, - @CheckForNull Object p1, - @CheckForNull Object p2) { + @CheckForNull @Readonly Object p1, + @CheckForNull @Readonly Object p2) { if (obj == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2)); } @@ -1397,9 +1398,9 @@ public static T checkNotNull( public static T checkNotNull( @CheckForNull T obj, String errorMessageTemplate, - @CheckForNull Object p1, - @CheckForNull Object p2, - @CheckForNull Object p3) { + @CheckForNull @Readonly Object p1, + @CheckForNull @Readonly Object p2, + @CheckForNull @Readonly Object p3) { if (obj == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2, p3)); } @@ -1418,10 +1419,10 @@ public static T checkNotNull( public static T checkNotNull( @CheckForNull T obj, String errorMessageTemplate, - @CheckForNull Object p1, - @CheckForNull Object p2, - @CheckForNull Object p3, - @CheckForNull Object p4) { + @CheckForNull @Readonly Object p1, + @CheckForNull @Readonly Object p2, + @CheckForNull @Readonly Object p3, + @CheckForNull @Readonly Object p4) { if (obj == null) { throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2, p3, p4)); } diff --git a/guava/src/com/google/common/base/Predicate.java b/guava/src/com/google/common/base/Predicate.java index 5aa88e761687..adeda30e4b5d 100644 --- a/guava/src/com/google/common/base/Predicate.java +++ b/guava/src/com/google/common/base/Predicate.java @@ -18,6 +18,8 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -43,11 +45,13 @@ * @author Kevin Bourrillion * @since 2.0 */ +@SuppressWarnings("pico") @FunctionalInterface @GwtCompatible @AnnotatedFor({"nullness"}) @ElementTypesAreNonnullByDefault -public interface Predicate extends java.util.function.Predicate { +@ReceiverDependentMutable +public interface Predicate extends java.util.function.Predicate { /** * Returns the result of applying this predicate to {@code input} (Java 8 users, see notes in the * class documentation above). This method is generally expected, but not absolutely @@ -78,7 +82,7 @@ public interface Predicate extends java.util.functio */ @Pure @Override - boolean equals(@CheckForNull Object object); + boolean equals(@CheckForNull @Readonly Object object); @Override default boolean test(@ParametricNullness T input) { diff --git a/guava/src/com/google/common/base/Predicates.java b/guava/src/com/google/common/base/Predicates.java index c6f219597f80..0b085cd0af9d 100644 --- a/guava/src/com/google/common/base/Predicates.java +++ b/guava/src/com/google/common/base/Predicates.java @@ -27,6 +27,7 @@ import java.util.regex.Pattern; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -45,6 +46,7 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Predicates { private Predicates() {} @@ -53,13 +55,13 @@ private Predicates() {} /** Returns a predicate that always evaluates to {@code true}. */ @GwtCompatible(serializable = true) - public static Predicate alwaysTrue() { + public static Predicate alwaysTrue() { return ObjectPredicate.ALWAYS_TRUE.withNarrowedType(); } /** Returns a predicate that always evaluates to {@code false}. */ @GwtCompatible(serializable = true) - public static Predicate alwaysFalse() { + public static Predicate alwaysFalse() { return ObjectPredicate.ALWAYS_FALSE.withNarrowedType(); } @@ -68,7 +70,7 @@ private Predicates() {} * null. */ @GwtCompatible(serializable = true) - public static Predicate isNull() { + public static Predicate isNull() { return ObjectPredicate.IS_NULL.withNarrowedType(); } @@ -77,7 +79,7 @@ private Predicates() {} * null. */ @GwtCompatible(serializable = true) - public static Predicate notNull() { + public static Predicate notNull() { return ObjectPredicate.NOT_NULL.withNarrowedType(); } @@ -85,7 +87,7 @@ private Predicates() {} * Returns a predicate that evaluates to {@code true} if the given predicate evaluates to {@code * false}. */ - public static Predicate not(Predicate predicate) { + public static Predicate not(Predicate predicate) { return new NotPredicate<>(predicate); } @@ -96,7 +98,7 @@ private Predicates() {} * changes to it won't alter the behavior of this predicate. If {@code components} is empty, the * returned predicate will always evaluate to {@code true}. */ - public static Predicate and( + public static Predicate and( Iterable> components) { return new AndPredicate<>(defensiveCopy(components)); } @@ -109,7 +111,7 @@ private Predicates() {} * returned predicate will always evaluate to {@code true}. */ @SafeVarargs - public static Predicate and(Predicate... components) { + public static Predicate and(Predicate... components) { return new AndPredicate(defensiveCopy(components)); } @@ -118,7 +120,7 @@ private Predicates() {} * true}. The components are evaluated in order, and evaluation will be "short-circuited" as soon * as a false predicate is found. */ - public static Predicate and( + public static Predicate and( Predicate first, Predicate second) { return new AndPredicate<>(Predicates.asList(checkNotNull(first), checkNotNull(second))); } @@ -130,7 +132,7 @@ private Predicates() {} * changes to it won't alter the behavior of this predicate. If {@code components} is empty, the * returned predicate will always evaluate to {@code false}. */ - public static Predicate or( + public static Predicate or( Iterable> components) { return new OrPredicate<>(defensiveCopy(components)); } @@ -143,7 +145,7 @@ private Predicates() {} * returned predicate will always evaluate to {@code false}. */ @SafeVarargs - public static Predicate or(Predicate... components) { + public static Predicate or(Predicate... components) { return new OrPredicate(defensiveCopy(components)); } @@ -152,7 +154,7 @@ private Predicates() {} * {@code true}. The components are evaluated in order, and evaluation will be "short-circuited" * as soon as a true predicate is found. */ - public static Predicate or( + public static Predicate or( Predicate first, Predicate second) { return new OrPredicate<>(Predicates.asList(checkNotNull(first), checkNotNull(second))); } @@ -161,7 +163,7 @@ private Predicates() {} * Returns a predicate that evaluates to {@code true} if the object being tested {@code equals()} * the given target or both are null. */ - public static Predicate equalTo(@ParametricNullness T target) { + public static Predicate equalTo(@ParametricNullness T target) { return (target == null) ? Predicates.isNull() : new IsEqualToPredicate(target).withNarrowedType(); @@ -181,7 +183,7 @@ private Predicates() {} * instances {@code Lists.newArrayList(1)} and {@code Arrays.asList(1)}. */ @GwtIncompatible // Class.isInstance - public static Predicate instanceOf(Class clazz) { + public static Predicate instanceOf(Class clazz) { return new InstanceOfPredicate<>(clazz); } @@ -216,7 +218,7 @@ public static Predicate> subtypeOf(Class clazz) { * * @param target the collection that may contain the function input */ - public static Predicate in(Collection target) { + public static Predicate in(Collection target) { return new InPredicate<>(target); } @@ -226,7 +228,7 @@ public static Predicate> subtypeOf(Class clazz) { * * @return the composition of the provided function and predicate */ - public static Predicate compose( + public static Predicate compose( Predicate predicate, Function function) { return new CompositionPredicate<>(predicate, function); } @@ -310,13 +312,13 @@ public String toString() { }; @SuppressWarnings("unchecked") // safe contravariant cast - Predicate withNarrowedType() { + Predicate withNarrowedType() { return (Predicate) this; } } /** @see Predicates#not(Predicate) */ - private static class NotPredicate + private static class NotPredicate implements Predicate, Serializable { final Predicate predicate; @@ -355,7 +357,7 @@ public String toString() { } /** @see Predicates#and(Iterable) */ - private static class AndPredicate + private static class AndPredicate implements Predicate, Serializable { private final List> components; @@ -401,7 +403,7 @@ public String toString() { } /** @see Predicates#or(Iterable) */ - private static class OrPredicate + private static class OrPredicate implements Predicate, Serializable { private final List> components; @@ -497,14 +499,14 @@ public String toString() { private static final long serialVersionUID = 0; @SuppressWarnings("unchecked") // safe contravariant cast - Predicate withNarrowedType() { + Predicate withNarrowedType() { return (Predicate) this; } } /** @see Predicates#instanceOf(Class) */ @GwtIncompatible // Class.isInstance - private static class InstanceOfPredicate + private static class InstanceOfPredicate implements Predicate, Serializable { private final Class clazz; @@ -579,7 +581,7 @@ public String toString() { } /** @see Predicates#in(Collection) */ - private static class InPredicate + private static class InPredicate implements Predicate, Serializable { private final Collection target; @@ -622,7 +624,7 @@ public String toString() { } /** @see Predicates#compose(Predicate, Function) */ - private static class CompositionPredicate + private static class CompositionPredicate implements Predicate, Serializable { final Predicate p; final Function f; @@ -727,7 +729,7 @@ public String toString() { private static final long serialVersionUID = 0; } - private static List> asList( + private static List> asList( Predicate first, Predicate second) { // TODO(kevinb): understand why we still get a warning despite @SafeVarargs! return Arrays.>asList(first, second); diff --git a/guava/src/com/google/common/base/Present.java b/guava/src/com/google/common/base/Present.java index 60eef32d8398..282d96081620 100644 --- a/guava/src/com/google/common/base/Present.java +++ b/guava/src/com/google/common/base/Present.java @@ -27,6 +27,7 @@ /** Implementation of an {@link Optional} containing a reference. */ @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class Present extends Optional { private final T reference; diff --git a/guava/src/com/google/common/base/Splitter.java b/guava/src/com/google/common/base/Splitter.java index cc606763956c..97f3fad82025 100644 --- a/guava/src/com/google/common/base/Splitter.java +++ b/guava/src/com/google/common/base/Splitter.java @@ -107,6 +107,7 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Splitter { private final CharMatcher trimmer; private final boolean omitEmptyStrings; diff --git a/guava/src/com/google/common/base/Strings.java b/guava/src/com/google/common/base/Strings.java index 7ac3abf8f2cd..9cfd7e33c852 100644 --- a/guava/src/com/google/common/base/Strings.java +++ b/guava/src/com/google/common/base/Strings.java @@ -28,6 +28,9 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; import org.checkerframework.framework.qual.EnsuresQualifierIf; /** @@ -36,6 +39,7 @@ * @author Kevin Bourrillion * @since 3.0 */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault public final class Strings { @@ -153,6 +157,7 @@ public static String padEnd(String string, int minLength, char padChar) { */ @InlineMe(replacement = "string.repeat(count)") @InlineMeValidationDisabled("Java 11+ API only") + @SuppressWarnings("pico:argument.type.incompatible") // cast from @Unique @Mutable to @Immutable public static String repeat(String string, @NonNegative int count) { checkNotNull(string); // eager for GWT. @@ -186,7 +191,7 @@ public static String repeat(String string, @NonNegative int count) { * * @since 11.0 */ - public static String commonPrefix(CharSequence a, CharSequence b) { + public static String commonPrefix(@Readonly CharSequence a, @Readonly CharSequence b) { checkNotNull(a); checkNotNull(b); @@ -209,7 +214,7 @@ public static String commonPrefix(CharSequence a, CharSequence b) { * * @since 11.0 */ - public static String commonSuffix(CharSequence a, CharSequence b) { + public static String commonSuffix(@Readonly CharSequence a, @Readonly CharSequence b) { checkNotNull(a); checkNotNull(b); @@ -230,7 +235,7 @@ public static String commonSuffix(CharSequence a, CharSequence b) { * Out-of-range indexes return false. */ @VisibleForTesting - static boolean validSurrogatePairAt(CharSequence string, int index) { + static boolean validSurrogatePairAt(@Readonly CharSequence string, int index) { return index >= 0 && index <= (string.length() - 2) && Character.isHighSurrogate(string.charAt(index)) @@ -271,11 +276,11 @@ static boolean validSurrogatePairAt(CharSequence string, int index) { */ // TODO(diamondm) consider using Arrays.toString() for array parameters public static String lenientFormat( - @CheckForNull String template, @CheckForNull @Nullable Object... args) { + @CheckForNull String template, @CheckForNull @Nullable @Readonly Object... args) { template = String.valueOf(template); // null -> "null" if (args == null) { - args = new Object[] {"(Object[])null"}; + args = new @Immutable Object[] {"(Object[])null"}; } else { for (int i = 0; i < args.length; i++) { args[i] = lenientToString(args[i]); @@ -311,7 +316,7 @@ public static String lenientFormat( return builder.toString(); } - private static String lenientToString(@CheckForNull Object o) { + private static String lenientToString(@CheckForNull @Readonly Object o) { if (o == null) { return "null"; } diff --git a/guava/src/com/google/common/base/Supplier.java b/guava/src/com/google/common/base/Supplier.java index b0724803c200..7d2f780e2845 100644 --- a/guava/src/com/google/common/base/Supplier.java +++ b/guava/src/com/google/common/base/Supplier.java @@ -17,6 +17,8 @@ import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -41,7 +43,9 @@ @GwtCompatible @FunctionalInterface @ElementTypesAreNonnullByDefault -public interface Supplier extends java.util.function.Supplier { +@ReceiverDependentMutable +@SuppressWarnings("pico") +public interface Supplier extends java.util.function.Supplier { /** * Retrieves an instance of the appropriate type. The returned object may or may not be a new * instance, depending on the implementation. diff --git a/guava/src/com/google/common/base/Suppliers.java b/guava/src/com/google/common/base/Suppliers.java index 4b12eae90f45..5ed0f48fec12 100644 --- a/guava/src/com/google/common/base/Suppliers.java +++ b/guava/src/com/google/common/base/Suppliers.java @@ -40,6 +40,7 @@ @AnnotatedFor({"nullness"}) @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Suppliers { private Suppliers() {} diff --git a/guava/src/com/google/common/base/internal/Finalizer.java b/guava/src/com/google/common/base/internal/Finalizer.java index 574d49526506..11968cd16d75 100644 --- a/guava/src/com/google/common/base/internal/Finalizer.java +++ b/guava/src/com/google/common/base/internal/Finalizer.java @@ -46,6 +46,7 @@ * stop itself. */ @AnnotatedFor({"nullness"}) +@SuppressWarnings("pico") // no @ElementTypesAreNonNullByDefault for the reasons discussed above public class Finalizer implements Runnable { diff --git a/guava/src/com/google/common/cache/AbstractLoadingCache.java b/guava/src/com/google/common/cache/AbstractLoadingCache.java index 489597c51843..6b81ade38075 100644 --- a/guava/src/com/google/common/cache/AbstractLoadingCache.java +++ b/guava/src/com/google/common/cache/AbstractLoadingCache.java @@ -39,6 +39,7 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class AbstractLoadingCache extends AbstractCache implements LoadingCache { diff --git a/guava/src/com/google/common/cache/Cache.java b/guava/src/com/google/common/cache/Cache.java index 8755595a075d..b75d88360b84 100644 --- a/guava/src/com/google/common/cache/Cache.java +++ b/guava/src/com/google/common/cache/Cache.java @@ -27,6 +27,13 @@ import java.util.concurrent.ExecutionException; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; + /** * A semi-persistent mapping from keys to values. Cache entries are manually added using {@link * #get(Object, Callable)} or {@link #put(Object, Object)}, and are stored in the cache until either @@ -40,10 +47,12 @@ * @author Charles Fry * @since 10.0 */ +@AnnotatedFor("pico") @DoNotMock("Use CacheBuilder.newBuilder().build()") @GwtCompatible @ElementTypesAreNonnullByDefault -public interface Cache { +@ReceiverDependentMutable +public interface Cache { /** * Returns the value associated with {@code key} in this cache, or {@code null} if there is no @@ -52,7 +61,7 @@ public interface Cache { * @since 11.0 */ @CheckForNull - V getIfPresent(@CompatibleWith("K") Object key); + V getIfPresent(@Readonly Cache this, @CompatibleWith("K") @Readonly Object key); /** * Returns the value associated with {@code key} in this cache, obtaining that value from {@code @@ -100,7 +109,7 @@ public interface Cache { * @throws ExecutionError if an error was thrown while loading the value * @since 11.0 */ - V get(K key, Callable loader) throws ExecutionException; + V get(@Readonly Cache this, K key, Callable loader) throws ExecutionException; /** * Returns a map of the values associated with {@code keys} in this cache. The returned map will @@ -112,7 +121,7 @@ public interface Cache { * is mostly the same as to plain Java. But to nullness checkers, they * differ: means "non-null types," while means "all types." */ - ImmutableMap getAllPresent(Iterable keys); + ImmutableMap getAllPresent(@Readonly Cache this, @Readonly Iterable keys); /** * Associates {@code value} with {@code key} in this cache. If the cache previously contained a @@ -123,7 +132,7 @@ public interface Cache { * * @since 11.0 */ - void put(K key, V value); + void put(@Mutable Cache this, K key, V value); /** * Copies all of the mappings from the specified map to the cache. The effect of this call is @@ -133,10 +142,10 @@ public interface Cache { * * @since 12.0 */ - void putAll(Map m); + void putAll(@Mutable Cache this, @Readonly Map m); /** Discards any cached value for key {@code key}. */ - void invalidate(@CompatibleWith("K") Object key); + void invalidate(@Mutable Cache this, @CompatibleWith("K") @Readonly Object key); /** * Discards any cached values for keys {@code keys}. @@ -144,14 +153,14 @@ public interface Cache { * @since 11.0 */ // For discussion of , see getAllPresent. - void invalidateAll(Iterable keys); + void invalidateAll(@Mutable Cache this, @Readonly Iterable keys); /** Discards all entries in the cache. */ - void invalidateAll(); + void invalidateAll(@Mutable Cache this); /** Returns the approximate number of entries in this cache. */ @CheckReturnValue - long size(); + long size(@Readonly Cache this); /** * Returns a current snapshot of this cache's cumulative statistics, or a set of default values if @@ -165,7 +174,7 @@ public interface Cache { * */ @CheckReturnValue - CacheStats stats(); + CacheStats stats(@Readonly Cache this); /** * Returns a view of the entries stored in this cache as a thread-safe map. Modifications made to @@ -176,11 +185,11 @@ public interface Cache { * created, it is undefined which of the changes (if any) will be reflected in that iterator. */ @CheckReturnValue - ConcurrentMap asMap(); + @PolyMutable ConcurrentMap asMap(@PolyMutable Cache this); /** * Performs any pending maintenance operations needed by the cache. Exactly which activities are * performed -- if any -- is implementation-dependent. */ - void cleanUp(); + void cleanUp(@Mutable Cache this); } diff --git a/guava/src/com/google/common/cache/CacheBuilder.java b/guava/src/com/google/common/cache/CacheBuilder.java index 668769b6ecfa..09c19a142218 100644 --- a/guava/src/com/google/common/cache/CacheBuilder.java +++ b/guava/src/com/google/common/cache/CacheBuilder.java @@ -193,6 +193,7 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class CacheBuilder { private static final int DEFAULT_INITIAL_CAPACITY = 16; private static final int DEFAULT_CONCURRENCY_LEVEL = 4; diff --git a/guava/src/com/google/common/cache/CacheBuilderSpec.java b/guava/src/com/google/common/cache/CacheBuilderSpec.java index b8447a38a001..de23b3ae976f 100644 --- a/guava/src/com/google/common/cache/CacheBuilderSpec.java +++ b/guava/src/com/google/common/cache/CacheBuilderSpec.java @@ -80,7 +80,7 @@ * @author Adam Winer * @since 12.0 */ -@SuppressWarnings("GoodTime") // lots of violations (nanosecond math) +@SuppressWarnings({"GoodTime", "pico"}) // lots of violations (nanosecond math) @GwtIncompatible @ElementTypesAreNonnullByDefault public final class CacheBuilderSpec { diff --git a/guava/src/com/google/common/cache/CacheLoader.java b/guava/src/com/google/common/cache/CacheLoader.java index 7a5e017d03d4..ca67c3281cfd 100644 --- a/guava/src/com/google/common/cache/CacheLoader.java +++ b/guava/src/com/google/common/cache/CacheLoader.java @@ -56,6 +56,7 @@ * @author Charles Fry * @since 10.0 */ +@SuppressWarnings("pico") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault public abstract class CacheLoader { diff --git a/guava/src/com/google/common/cache/CacheStats.java b/guava/src/com/google/common/cache/CacheStats.java index 4ed0854314be..9509f1bc0284 100644 --- a/guava/src/com/google/common/cache/CacheStats.java +++ b/guava/src/com/google/common/cache/CacheStats.java @@ -24,6 +24,7 @@ import java.util.concurrent.Callable; import javax.annotation.CheckForNull; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.checker.pico.qual.Immutable; /** * Statistics about the performance of a {@link Cache}. Instances of this class are immutable. @@ -59,6 +60,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault +@Immutable public final class CacheStats { private final long hitCount; private final long missCount; diff --git a/guava/src/com/google/common/cache/ForwardingCache.java b/guava/src/com/google/common/cache/ForwardingCache.java index f118977b09a3..b0f923e5947d 100644 --- a/guava/src/com/google/common/cache/ForwardingCache.java +++ b/guava/src/com/google/common/cache/ForwardingCache.java @@ -24,6 +24,8 @@ import java.util.concurrent.ExecutionException; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Immutable; + /** * A cache which forwards all its method calls to another cache. Subclasses should override one or * more methods to modify the behavior of the backing cache as desired per the extends ForwardingObject implements Cache { +public abstract class ForwardingCache extends ForwardingObject implements Cache { /** Constructor for use by subclasses. */ protected ForwardingCache() {} @@ -120,7 +122,8 @@ public void cleanUp() { * * @since 10.0 */ - public abstract static class SimpleForwardingCache extends ForwardingCache { + + public abstract static class SimpleForwardingCache extends ForwardingCache { private final Cache delegate; protected SimpleForwardingCache(Cache delegate) { diff --git a/guava/src/com/google/common/cache/ForwardingLoadingCache.java b/guava/src/com/google/common/cache/ForwardingLoadingCache.java index ecd44ca8d8a9..f6da8aec6136 100644 --- a/guava/src/com/google/common/cache/ForwardingLoadingCache.java +++ b/guava/src/com/google/common/cache/ForwardingLoadingCache.java @@ -19,6 +19,9 @@ import com.google.common.collect.ImmutableMap; import java.util.concurrent.ExecutionException; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; + /** * A cache which forwards all its method calls to another cache. Subclasses should override one or * more methods to modify the behavior of the backing cache as desired per the extends ForwardingCache +@ReceiverDependentMutable +@SuppressWarnings("pico") +public abstract class ForwardingLoadingCache extends ForwardingCache implements LoadingCache { /** Constructor for use by subclasses. */ @@ -72,11 +77,12 @@ public void refresh(K key) { * * @since 10.0 */ - public abstract static class SimpleForwardingLoadingCache + @ReceiverDependentMutable + public abstract static class SimpleForwardingLoadingCache extends ForwardingLoadingCache { private final LoadingCache delegate; - protected SimpleForwardingLoadingCache(LoadingCache delegate) { + protected SimpleForwardingLoadingCache(@ReceiverDependentMutable LoadingCache delegate) { this.delegate = Preconditions.checkNotNull(delegate); } diff --git a/guava/src/com/google/common/cache/LoadingCache.java b/guava/src/com/google/common/cache/LoadingCache.java index e338ac4c3733..3e19c5805cd0 100644 --- a/guava/src/com/google/common/cache/LoadingCache.java +++ b/guava/src/com/google/common/cache/LoadingCache.java @@ -22,6 +22,13 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutionException; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; + /** * A semi-persistent mapping from keys to values. Values are automatically loaded by the cache, and * are stored in the cache until either evicted or manually invalidated. The common way to build @@ -38,9 +45,11 @@ * @author Charles Fry * @since 11.0 */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -public interface LoadingCache extends Cache, Function { +@ReceiverDependentMutable +public interface LoadingCache extends Cache, Function { /** * Returns the value associated with {@code key} in this cache, first loading that value if @@ -67,7 +76,7 @@ public interface LoadingCache extends Cache, Function { * value * @throws ExecutionError if an error was thrown while loading the value */ - V get(K key) throws ExecutionException; + V get(@Readonly LoadingCache this, K key) throws ExecutionException; /** * Returns the value associated with {@code key} in this cache, first loading that value if @@ -93,7 +102,7 @@ public interface LoadingCache extends Cache, Function { * explained in the last paragraph above, this should be an unchecked exception only.) * @throws ExecutionError if an error was thrown while loading the value */ - V getUnchecked(K key); + V getUnchecked(@Readonly LoadingCache this, K key); /** * Returns a map of the values associated with {@code keys}, creating or retrieving those values @@ -119,7 +128,7 @@ public interface LoadingCache extends Cache, Function { * @throws ExecutionError if an error was thrown while loading the values * @since 11.0 */ - ImmutableMap getAll(Iterable keys) throws ExecutionException; + ImmutableMap getAll(@Readonly LoadingCache this, @Readonly Iterable keys) throws ExecutionException; /** * @deprecated Provided to satisfy the {@code Function} interface; use {@link #get} or {@link @@ -130,7 +139,7 @@ public interface LoadingCache extends Cache, Function { */ @Deprecated @Override - V apply(K key); + V apply(@Readonly LoadingCache this, K key); /** * Loads a new value for {@code key}, possibly asynchronously. While the new value is loading the @@ -150,7 +159,7 @@ public interface LoadingCache extends Cache, Function { * * @since 11.0 */ - void refresh(K key); + void refresh(@Mutable LoadingCache this, K key); /** * {@inheritDoc} @@ -159,5 +168,5 @@ public interface LoadingCache extends Cache, Function { * cause entries to be automatically loaded. */ @Override - ConcurrentMap asMap(); + @PolyMutable ConcurrentMap asMap(@PolyMutable LoadingCache this); } diff --git a/guava/src/com/google/common/cache/LocalCache.java b/guava/src/com/google/common/cache/LocalCache.java index c9462c62a5c6..cef13fd596cf 100644 --- a/guava/src/com/google/common/cache/LocalCache.java +++ b/guava/src/com/google/common/cache/LocalCache.java @@ -89,6 +89,8 @@ import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; @@ -105,10 +107,11 @@ @SuppressWarnings({ "GoodTime", // lots of violations (nanosecond math) "nullness", // too much trouble for the payoff + "pico" }) @GwtCompatible(emulated = true) // TODO(cpovirk): Annotate for nullness. -class LocalCache extends AbstractMap implements ConcurrentMap { +class LocalCache extends AbstractMap implements ConcurrentMap { /* * The basic strategy is to subdivide the table among Segments, each of which itself is a @@ -403,7 +406,7 @@ Equivalence defaultEquivalence() { }, SOFT { @Override - ValueReference referenceValue( + ValueReference referenceValue( Segment segment, ReferenceEntry entry, V value, int weight) { return (weight == 1) ? new SoftValueReference(segment.valueReferenceQueue, value, entry) @@ -418,7 +421,7 @@ Equivalence defaultEquivalence() { }, WEAK { @Override - ValueReference referenceValue( + ValueReference referenceValue( Segment segment, ReferenceEntry entry, V value, int weight) { return (weight == 1) ? new WeakValueReference(segment.valueReferenceQueue, value, entry) @@ -427,13 +430,13 @@ ValueReference referenceValue( } @Override - Equivalence defaultEquivalence() { + Equivalence<@Readonly Object> defaultEquivalence() { return Equivalence.identity(); } }; /** Creates a reference for the given value according to this value strength. */ - abstract ValueReference referenceValue( + abstract ValueReference referenceValue( Segment segment, ReferenceEntry entry, V value, int weight); /** @@ -441,27 +444,27 @@ abstract ValueReference referenceValue( * at this strength. This strategy will be used unless the user explicitly specifies an * alternate strategy. */ - abstract Equivalence defaultEquivalence(); + abstract Equivalence<@Readonly Object> defaultEquivalence(); } /** Creates new entries. */ enum EntryFactory { STRONG { @Override - ReferenceEntry newEntry( + ReferenceEntry newEntry( Segment segment, K key, int hash, @Nullable ReferenceEntry next) { return new StrongEntry<>(key, hash, next); } }, STRONG_ACCESS { @Override - ReferenceEntry newEntry( + ReferenceEntry newEntry( Segment segment, K key, int hash, @Nullable ReferenceEntry next) { return new StrongAccessEntry<>(key, hash, next); } @Override - ReferenceEntry copyEntry( + ReferenceEntry copyEntry( Segment segment, ReferenceEntry original, ReferenceEntry newNext) { ReferenceEntry newEntry = super.copyEntry(segment, original, newNext); copyAccessEntry(original, newEntry); @@ -470,13 +473,13 @@ ReferenceEntry copyEntry( }, STRONG_WRITE { @Override - ReferenceEntry newEntry( + ReferenceEntry newEntry( Segment segment, K key, int hash, @Nullable ReferenceEntry next) { return new StrongWriteEntry<>(key, hash, next); } @Override - ReferenceEntry copyEntry( + ReferenceEntry copyEntry( Segment segment, ReferenceEntry original, ReferenceEntry newNext) { ReferenceEntry newEntry = super.copyEntry(segment, original, newNext); copyWriteEntry(original, newEntry); @@ -485,13 +488,13 @@ ReferenceEntry copyEntry( }, STRONG_ACCESS_WRITE { @Override - ReferenceEntry newEntry( + ReferenceEntry newEntry( Segment segment, K key, int hash, @Nullable ReferenceEntry next) { return new StrongAccessWriteEntry<>(key, hash, next); } @Override - ReferenceEntry copyEntry( + ReferenceEntry copyEntry( Segment segment, ReferenceEntry original, ReferenceEntry newNext) { ReferenceEntry newEntry = super.copyEntry(segment, original, newNext); copyAccessEntry(original, newEntry); @@ -501,20 +504,20 @@ ReferenceEntry copyEntry( }, WEAK { @Override - ReferenceEntry newEntry( + ReferenceEntry newEntry( Segment segment, K key, int hash, @Nullable ReferenceEntry next) { return new WeakEntry<>(segment.keyReferenceQueue, key, hash, next); } }, WEAK_ACCESS { @Override - ReferenceEntry newEntry( + ReferenceEntry newEntry( Segment segment, K key, int hash, @Nullable ReferenceEntry next) { return new WeakAccessEntry<>(segment.keyReferenceQueue, key, hash, next); } @Override - ReferenceEntry copyEntry( + ReferenceEntry copyEntry( Segment segment, ReferenceEntry original, ReferenceEntry newNext) { ReferenceEntry newEntry = super.copyEntry(segment, original, newNext); copyAccessEntry(original, newEntry); @@ -523,13 +526,13 @@ ReferenceEntry copyEntry( }, WEAK_WRITE { @Override - ReferenceEntry newEntry( + ReferenceEntry newEntry( Segment segment, K key, int hash, @Nullable ReferenceEntry next) { return new WeakWriteEntry<>(segment.keyReferenceQueue, key, hash, next); } @Override - ReferenceEntry copyEntry( + ReferenceEntry copyEntry( Segment segment, ReferenceEntry original, ReferenceEntry newNext) { ReferenceEntry newEntry = super.copyEntry(segment, original, newNext); copyWriteEntry(original, newEntry); @@ -538,13 +541,13 @@ ReferenceEntry copyEntry( }, WEAK_ACCESS_WRITE { @Override - ReferenceEntry newEntry( + ReferenceEntry newEntry( Segment segment, K key, int hash, @Nullable ReferenceEntry next) { return new WeakAccessWriteEntry<>(segment.keyReferenceQueue, key, hash, next); } @Override - ReferenceEntry copyEntry( + ReferenceEntry copyEntry( Segment segment, ReferenceEntry original, ReferenceEntry newNext) { ReferenceEntry newEntry = super.copyEntry(segment, original, newNext); copyAccessEntry(original, newEntry); @@ -588,7 +591,7 @@ static EntryFactory getFactory( * @param hash of the key * @param next entry in the same bucket */ - abstract ReferenceEntry newEntry( + abstract ReferenceEntry newEntry( Segment segment, K key, int hash, @Nullable ReferenceEntry next); /** @@ -598,13 +601,13 @@ abstract ReferenceEntry newEntry( * @param newNext entry in the same bucket */ // Guarded By Segment.this - ReferenceEntry copyEntry( + ReferenceEntry copyEntry( Segment segment, ReferenceEntry original, ReferenceEntry newNext) { return newEntry(segment, original.getKey(), original.getHash(), newNext); } // Guarded By Segment.this - void copyAccessEntry(ReferenceEntry original, ReferenceEntry newEntry) { + void copyAccessEntry(ReferenceEntry original, ReferenceEntry newEntry) { // TODO(fry): when we link values instead of entries this method can go // away, as can connectAccessOrder, nullifyAccessOrder. newEntry.setAccessTime(original.getAccessTime()); @@ -616,7 +619,7 @@ void copyAccessEntry(ReferenceEntry original, ReferenceEntry } // Guarded By Segment.this - void copyWriteEntry(ReferenceEntry original, ReferenceEntry newEntry) { + void copyWriteEntry(ReferenceEntry original, ReferenceEntry newEntry) { // TODO(fry): when we link values instead of entries this method can go // away, as can connectWriteOrder, nullifyWriteOrder. newEntry.setWriteTime(original.getWriteTime()); @@ -629,7 +632,7 @@ void copyWriteEntry(ReferenceEntry original, ReferenceEntry n } /** A reference to a value. */ - interface ValueReference { + interface ValueReference { /** Returns the value. Does not block or throw exceptions. */ @Nullable V get(); @@ -685,8 +688,8 @@ ValueReference copyFor( } /** Placeholder. Indicates that the value hasn't been set yet. */ - static final ValueReference UNSET = - new ValueReference() { + static final ValueReference<@Immutable Object, @Readonly Object> UNSET = + new ValueReference<@Immutable Object, @Readonly Object>() { @Override public Object get() { return null; @@ -1497,7 +1500,7 @@ public V waitForValue() { } /** References a soft value. */ - static class SoftValueReference extends SoftReference implements ValueReference { + static class SoftValueReference extends SoftReference implements ValueReference { final ReferenceEntry entry; SoftValueReference(ReferenceQueue queue, V referent, ReferenceEntry entry) { @@ -1835,7 +1838,7 @@ final Segment[] newSegmentArray(int ssize) { * opportunistically, just to simplify some locking and avoid separate construction. */ @SuppressWarnings("serial") // This class is never serialized. - static class Segment extends ReentrantLock { + static class Segment extends ReentrantLock { /* * TODO(fry): Consider copying variables (like evictsBySize) from outer class into this class. diff --git a/guava/src/com/google/common/cache/ReferenceEntry.java b/guava/src/com/google/common/cache/ReferenceEntry.java index 8ff2e6c9b4ff..1f52ae7027f0 100644 --- a/guava/src/com/google/common/cache/ReferenceEntry.java +++ b/guava/src/com/google/common/cache/ReferenceEntry.java @@ -40,6 +40,7 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") interface ReferenceEntry { /** Returns the value reference from this entry. */ @CheckForNull diff --git a/guava/src/com/google/common/cache/RemovalNotification.java b/guava/src/com/google/common/cache/RemovalNotification.java index b96fc570911f..dabb0f7c3d77 100644 --- a/guava/src/com/google/common/cache/RemovalNotification.java +++ b/guava/src/com/google/common/cache/RemovalNotification.java @@ -34,6 +34,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class RemovalNotification extends SimpleImmutableEntry<@Nullable K, @Nullable V> { private final RemovalCause cause; diff --git a/guava/src/com/google/common/cache/Striped64.java b/guava/src/com/google/common/cache/Striped64.java index 0d2d75b9f384..be63673d8963 100644 --- a/guava/src/com/google/common/cache/Striped64.java +++ b/guava/src/com/google/common/cache/Striped64.java @@ -23,6 +23,7 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") abstract class Striped64 extends Number { /* * This class maintains a lazily-initialized table of atomically diff --git a/guava/src/com/google/common/collect/AbstractBiMap.java b/guava/src/com/google/common/collect/AbstractBiMap.java index 2461e956cf30..45ceecd59374 100644 --- a/guava/src/com/google/common/collect/AbstractBiMap.java +++ b/guava/src/com/google/common/collect/AbstractBiMap.java @@ -36,9 +36,17 @@ import java.util.Set; import java.util.function.BiFunction; import javax.annotation.CheckForNull; + +import org.checkerframework.checker.initialization.qual.UnderInitialization; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; @@ -55,42 +63,43 @@ * @author Kevin Bourrillion * @author Mike Bostock */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -abstract class AbstractBiMap +@ReceiverDependentMutable +abstract class AbstractBiMap extends ForwardingMap implements BiMap, Serializable { private transient Map delegate; @RetainedWith transient AbstractBiMap inverse; /** Package-private constructor for creating a map-backed bimap. */ - AbstractBiMap(Map forward, Map backward) { + AbstractBiMap(@ReceiverDependentMutable Map forward, @ReceiverDependentMutable Map backward) { setDelegates(forward, backward); } /** Private constructor for inverse bimap. */ - private AbstractBiMap(Map backward, AbstractBiMap forward) { + private AbstractBiMap(@ReceiverDependentMutable Map backward, @ReceiverDependentMutable AbstractBiMap forward) { delegate = backward; inverse = forward; } @Override - protected Map delegate() { + protected @PolyMutable Map delegate(@PolyMutable AbstractBiMap this) { return delegate; } /** Returns its input, or throws an exception if this is not a valid key. */ @CanIgnoreReturnValue @ParametricNullness - K checkKey(@ParametricNullness K key) { + K checkKey(@Readonly AbstractBiMap this, @ParametricNullness K key) { return key; } /** Returns its input, or throws an exception if this is not a valid value. */ @CanIgnoreReturnValue @ParametricNullness - V checkValue(@ParametricNullness V value) { + V checkValue(@Readonly AbstractBiMap this, @ParametricNullness V value) { return value; } @@ -98,7 +107,7 @@ V checkValue(@ParametricNullness V value) { * Specifies the delegate maps going in each direction. Called by the constructor and by * subclasses during deserialization. */ - void setDelegates(Map forward, Map backward) { + void setDelegates(@UnderInitialization AbstractBiMap this, @ReceiverDependentMutable Map forward, @ReceiverDependentMutable Map backward) { checkState(delegate == null); checkState(inverse == null); checkArgument(forward.isEmpty()); @@ -108,11 +117,11 @@ void setDelegates(Map forward, Map backward) { inverse = makeInverse(backward); } - AbstractBiMap makeInverse(Map backward) { - return new Inverse<>(backward, this); + @ReceiverDependentMutable AbstractBiMap makeInverse(@ReceiverDependentMutable Map backward) { + return new @ReceiverDependentMutable Inverse<>(backward, this); } - void setInverse(AbstractBiMap inverse) { + void setInverse(@UnderInitialization AbstractBiMap this, @ReceiverDependentMutable AbstractBiMap inverse) { this.inverse = inverse; } @@ -120,7 +129,7 @@ void setInverse(AbstractBiMap inverse) { @Pure @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly AbstractBiMap this, @CheckForNull @UnknownSignedness @Readonly Object value) { return inverse.containsKey(value); } @@ -129,19 +138,19 @@ public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { @CanIgnoreReturnValue @Override @CheckForNull - public V put(@ParametricNullness K key, @ParametricNullness V value) { + public V put(@Mutable AbstractBiMap this, @ParametricNullness K key, @ParametricNullness V value) { return putInBothMaps(key, value, false); } @CanIgnoreReturnValue @Override @CheckForNull - public V forcePut(@ParametricNullness K key, @ParametricNullness V value) { + public V forcePut(@Mutable AbstractBiMap this, @ParametricNullness K key, @ParametricNullness V value) { return putInBothMaps(key, value, true); } @CheckForNull - private V putInBothMaps(@ParametricNullness K key, @ParametricNullness V value, boolean force) { + private V putInBothMaps(@Mutable AbstractBiMap this, @ParametricNullness K key, @ParametricNullness V value, boolean force) { checkKey(key); checkValue(value); boolean containedKey = containsKey(key); @@ -159,6 +168,7 @@ private V putInBothMaps(@ParametricNullness K key, @ParametricNullness V value, } private void updateInverseMap( + @Mutable AbstractBiMap this, @ParametricNullness K key, boolean containedKey, @CheckForNull V oldValue, @@ -173,34 +183,34 @@ private void updateInverseMap( @CanIgnoreReturnValue @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@Mutable AbstractBiMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return containsKey(key) ? removeFromBothMaps(key) : null; } @CanIgnoreReturnValue @ParametricNullness - private V removeFromBothMaps(@CheckForNull Object key) { + private V removeFromBothMaps(@Mutable AbstractBiMap this, @CheckForNull @Readonly Object key) { // The cast is safe because the callers of this method first check that the key is present. V oldValue = uncheckedCastNullableTToT(delegate.remove(key)); removeFromInverseMap(oldValue); return oldValue; } - private void removeFromInverseMap(@ParametricNullness V oldValue) { + private void removeFromInverseMap(@Mutable AbstractBiMap this, @ParametricNullness V oldValue) { inverse.delegate.remove(oldValue); } // Bulk Operations @Override - public void putAll(Map map) { + public void putAll(@Mutable AbstractBiMap this, @Readonly Map map) { for (Entry entry : map.entrySet()) { put(entry.getKey(), entry.getValue()); } } @Override - public void replaceAll(BiFunction function) { + public void replaceAll(@Mutable AbstractBiMap this, BiFunction function) { this.delegate.replaceAll(function); inverse.delegate.clear(); Entry broken = null; @@ -223,7 +233,7 @@ public void replaceAll(BiFunction function) { } @Override - public void clear() { + public void clear(@Mutable AbstractBiMap this) { delegate.clear(); inverse.delegate.clear(); } @@ -231,33 +241,35 @@ public void clear() { // Views @Override - public BiMap inverse() { + public @PolyMutable BiMap inverse(@PolyMutable AbstractBiMap this) { return inverse; } - @CheckForNull private transient Set keySet; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable Set keySet; @SideEffectFree @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable AbstractBiMap this) { Set result = keySet; return (result == null) ? keySet = new KeySet() : result; } @WeakOuter + @ReceiverDependentMutable private class KeySet extends ForwardingSet { @Override - protected Set delegate() { + protected @PolyMutable Set delegate(@PolyMutable KeySet this) { return delegate.keySet(); } @Override - public void clear() { + public void clear(@Mutable KeySet this) { AbstractBiMap.this.clear(); } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object key) { + public boolean remove(@Mutable KeySet this, @CheckForNull @UnknownSignedness @Readonly Object key) { if (!contains(key)) { return false; } @@ -266,26 +278,27 @@ public boolean remove(@CheckForNull @UnknownSignedness Object key) { } @Override - public boolean removeAll(Collection keysToRemove) { + public boolean removeAll(@Mutable KeySet this, @Readonly Collection keysToRemove) { return standardRemoveAll(keysToRemove); } @Override - public boolean retainAll(Collection keysToRetain) { + public boolean retainAll(@Mutable KeySet this, @Readonly Collection keysToRetain) { return standardRetainAll(keysToRetain); } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly KeySet this) { return Maps.keyIterator(entrySet().iterator()); } } - @CheckForNull private transient Set valueSet; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable Set valueSet; @SideEffectFree @Override - public Set values() { + public @PolyMutable Set values(@PolyMutable AbstractBiMap this) { /* * We can almost reuse the inverse's keySet, except we have to fix the * iteration order so that it is consistent with the forward map. @@ -295,16 +308,17 @@ public Set values() { } @WeakOuter + @ReceiverDependentMutable private class ValueSet extends ForwardingSet { final Set valuesDelegate = inverse.keySet(); @Override - protected Set delegate() { + protected @PolyMutable Set delegate(@PolyMutable ValueSet this) { return valuesDelegate; } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly ValueSet this) { return Maps.valueIterator(entrySet().iterator()); } @@ -316,7 +330,7 @@ public Iterator iterator() { @Override @SuppressWarnings("nullness") // bug in our checker's handling of toArray signatures - public T[] toArray(T[] array) { + public T[] toArray(T[] array) { return standardToArray(array); } @@ -327,29 +341,31 @@ public String toString() { } } - @CheckForNull private transient Set> entrySet; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable Set> entrySet; @SideEffectFree @Override - public Set> entrySet() { + public @PolyMutable Set> entrySet(@PolyMutable AbstractBiMap this) { Set> result = entrySet; return (result == null) ? entrySet = new EntrySet() : result; } + @ReceiverDependentMutable class BiMapEntry extends ForwardingMapEntry { private final Entry delegate; - BiMapEntry(Entry delegate) { + BiMapEntry(@ReceiverDependentMutable Entry delegate) { this.delegate = delegate; } @Override - protected Entry delegate() { + protected @PolyMutable Entry delegate(@PolyMutable BiMapEntry this) { return delegate; } @Override - public V setValue(V value) { + public V setValue(@Mutable BiMapEntry this, V value) { checkValue(value); // Preconditions keep the map and inverse consistent. checkState(entrySet().contains(this), "entry no longer in map"); @@ -365,7 +381,7 @@ public V setValue(V value) { } } - Iterator> entrySetIterator() { + Iterator> entrySetIterator(@Readonly AbstractBiMap this) { final Iterator> iterator = delegate.entrySet().iterator(); return new Iterator>() { @CheckForNull Entry entry; @@ -395,21 +411,22 @@ public void remove() { } @WeakOuter + @ReceiverDependentMutable private class EntrySet extends ForwardingSet> { final Set> esDelegate = delegate.entrySet(); @Override - protected Set> delegate() { + protected Set> delegate(@PolyMutable EntrySet this) { return esDelegate; } @Override - public void clear() { + public void clear(@Mutable EntrySet this) { AbstractBiMap.this.clear(); } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object object) { + public boolean remove(@Mutable EntrySet this, @CheckForNull @UnknownSignedness @Readonly Object object) { /* * `o instanceof Entry` is guaranteed by `contains`, but we check it here to satisfy our * nullness checker. @@ -430,7 +447,7 @@ public boolean remove(@CheckForNull @UnknownSignedness Object object) { } @Override - public Iterator> iterator() { + public Iterator> iterator(@Readonly EntrySet this) { return entrySetIterator(); } @@ -451,37 +468,38 @@ public Iterator> iterator() { @Override @SuppressWarnings("nullness") // bug in our checker's handling of toArray signatures - public T[] toArray(T[] array) { + public T[] toArray(T[] array) { return standardToArray(array); } @Pure @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly EntrySet this, @CheckForNull @UnknownSignedness @Readonly Object o) { return Maps.containsEntryImpl(delegate(), o); } @Pure @Override - public boolean containsAll(Collection c) { + public boolean containsAll(@Readonly EntrySet this, @Readonly Collection c) { return standardContainsAll(c); } @Override - public boolean removeAll(Collection c) { + public boolean removeAll(@Mutable EntrySet this, @Readonly Collection c) { return standardRemoveAll(c); } @Override - public boolean retainAll(Collection c) { + public boolean retainAll(@Mutable EntrySet this, @Readonly Collection c) { return standardRetainAll(c); } } /** The inverse of any other {@code AbstractBiMap} subclass. */ - static class Inverse + @ReceiverDependentMutable + static class Inverse extends AbstractBiMap { - Inverse(Map backward, AbstractBiMap forward) { + Inverse(@ReceiverDependentMutable Map backward, @ReceiverDependentMutable AbstractBiMap forward) { super(backward, forward); } @@ -496,13 +514,13 @@ static class Inverse @Override @ParametricNullness - K checkKey(@ParametricNullness K key) { + K checkKey(@Readonly Inverse this, @ParametricNullness K key) { return inverse.checkValue(key); } @Override @ParametricNullness - V checkValue(@ParametricNullness V value) { + V checkValue(@Readonly Inverse this, @ParametricNullness V value) { return inverse.checkKey(value); } diff --git a/guava/src/com/google/common/collect/AbstractIndexedListIterator.java b/guava/src/com/google/common/collect/AbstractIndexedListIterator.java index b4872137b70d..8751325996fc 100644 --- a/guava/src/com/google/common/collect/AbstractIndexedListIterator.java +++ b/guava/src/com/google/common/collect/AbstractIndexedListIterator.java @@ -23,6 +23,11 @@ import java.util.NoSuchElementException; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * This class provides a skeletal implementation of the {@link ListIterator} interface across a @@ -31,16 +36,19 @@ * * @author Jared Levy */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class AbstractIndexedListIterator +@CFComment("AOSEN: Is this a design issue?") +@ReceiverDependentMutable +abstract class AbstractIndexedListIterator extends UnmodifiableListIterator { private final int size; private int position; /** Returns the element with the specified index. This method is called by {@link #next()}. */ @ParametricNullness - protected abstract E get(int index); + protected abstract E get(@Readonly AbstractIndexedListIterator this, int index); /** * Constructs an iterator across a sequence of the given size whose initial position is 0. That @@ -70,13 +78,13 @@ protected AbstractIndexedListIterator(int size, int position) { } @Override - public final boolean hasNext() { + public final boolean hasNext(@Readonly AbstractIndexedListIterator this) { return position < size; } @Override @ParametricNullness - public final E next() { + public final E next(@Mutable AbstractIndexedListIterator this) { if (!hasNext()) { throw new NoSuchElementException(); } @@ -84,18 +92,18 @@ public final E next() { } @Override - public final @NonNegative int nextIndex() { + public final @NonNegative int nextIndex(@Readonly AbstractIndexedListIterator this) { return position; } @Override - public final boolean hasPrevious() { + public final boolean hasPrevious(@Readonly AbstractIndexedListIterator this) { return position > 0; } @Override @ParametricNullness - public final E previous() { + public final E previous(@Mutable AbstractIndexedListIterator this) { if (!hasPrevious()) { throw new NoSuchElementException(); } @@ -103,7 +111,7 @@ public final E previous() { } @Override - public final @NonNegative int previousIndex() { + public final @NonNegative int previousIndex(@Readonly AbstractIndexedListIterator this) { return position - 1; } } diff --git a/guava/src/com/google/common/collect/AbstractIterator.java b/guava/src/com/google/common/collect/AbstractIterator.java index 1db85d67351a..3b67474b1d81 100644 --- a/guava/src/com/google/common/collect/AbstractIterator.java +++ b/guava/src/com/google/common/collect/AbstractIterator.java @@ -24,7 +24,11 @@ import java.util.NoSuchElementException; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * This class provides a skeletal implementation of the {@code Iterator} interface, to make this @@ -63,10 +67,12 @@ */ // When making changes to this class, please also update the copy at // com.google.common.base.AbstractIterator -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class AbstractIterator extends UnmodifiableIterator { +@CFComment("AOSEN: Is this a design issue?") +@ReceiverDependentMutable +public abstract class AbstractIterator extends UnmodifiableIterator { private State state = State.NOT_READY; /** Constructor for use by subclasses. */ @@ -113,7 +119,7 @@ private enum State { * IllegalStateException}. */ @CheckForNull - protected abstract T computeNext(); + protected abstract T computeNext(@Mutable AbstractIterator this); /** * Implementations of {@link #computeNext} must invoke this method when there are no @@ -124,14 +130,14 @@ private enum State { */ @CanIgnoreReturnValue @CheckForNull - protected final T endOfData() { + protected final T endOfData(@Mutable AbstractIterator this) { state = State.DONE; return null; } @CanIgnoreReturnValue // TODO(kak): Should we remove this? Some people are using it to prefetch? @Override - public final boolean hasNext() { + public final boolean hasNext(@Readonly AbstractIterator this) { checkState(state != State.FAILED); switch (state) { case DONE: @@ -143,7 +149,7 @@ public final boolean hasNext() { return tryToComputeNext(); } - private boolean tryToComputeNext() { + private boolean tryToComputeNext(@Mutable AbstractIterator this) { state = State.FAILED; // temporary pessimism next = computeNext(); if (state != State.DONE) { @@ -156,7 +162,7 @@ private boolean tryToComputeNext() { @CanIgnoreReturnValue // TODO(kak): Should we remove this? @Override @ParametricNullness - public final T next() { + public final T next(@Mutable AbstractIterator this) { if (!hasNext()) { throw new NoSuchElementException(); } @@ -175,7 +181,7 @@ public final T next() { * implement {@code PeekingIterator}. */ @ParametricNullness - public final T peek() { + public final T peek(@Readonly AbstractIterator this) { if (!hasNext()) { throw new NoSuchElementException(); } diff --git a/guava/src/com/google/common/collect/AbstractListMultimap.java b/guava/src/com/google/common/collect/AbstractListMultimap.java index 35cb3322fbe1..628b8b48a751 100644 --- a/guava/src/com/google/common/collect/AbstractListMultimap.java +++ b/guava/src/com/google/common/collect/AbstractListMultimap.java @@ -24,6 +24,11 @@ import java.util.Map; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -38,14 +43,15 @@ @AnnotatedFor({"nullness"}) @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class AbstractListMultimap +@ReceiverDependentMutable +abstract class AbstractListMultimap extends AbstractMapBasedMultimap implements ListMultimap { /** * Creates a new multimap that uses the provided map. * * @param map place to store the mapping from each key to its corresponding values */ - protected AbstractListMultimap(Map> map) { + protected AbstractListMultimap(@ReceiverDependentMutable Map> map) { super(map); } @@ -53,12 +59,12 @@ protected AbstractListMultimap(Map> map) { abstract List createCollection(); @Override - List createUnmodifiableEmptyCollection() { + @Immutable List createUnmodifiableEmptyCollection() { return Collections.emptyList(); } @Override - Collection unmodifiableCollectionSubclass( + @Immutable Collection unmodifiableCollectionSubclass( Collection collection) { return Collections.unmodifiableList((List) collection); } @@ -78,8 +84,8 @@ Collection wrapCollection(@ParametricNullness K key, Collection collection * Multimap} interface. */ @Override - public List get(@ParametricNullness K key) { - return (List) super.get(key); + public @PolyMutable List get(@PolyMutable AbstractListMultimap this, @ParametricNullness K key) { + return (@PolyMutable List) super.get(key); } /** @@ -91,8 +97,8 @@ public List get(@ParametricNullness K key) { */ @CanIgnoreReturnValue @Override - public List removeAll(@CheckForNull Object key) { - return (List) super.removeAll(key); + public @Readonly List removeAll(@Mutable AbstractListMultimap this, @CheckForNull @Readonly Object key) { + return (@Readonly List) super.removeAll(key); } /** @@ -104,8 +110,8 @@ public List removeAll(@CheckForNull Object key) { */ @CanIgnoreReturnValue @Override - public List replaceValues(@ParametricNullness K key, Iterable values) { - return (List) super.replaceValues(key, values); + public @Readonly List replaceValues(@Mutable AbstractListMultimap this, @ParametricNullness K key, Iterable values) { + return (@Readonly List) super.replaceValues(key, values); } /** @@ -117,7 +123,7 @@ public List replaceValues(@ParametricNullness K key, Iterable va */ @CanIgnoreReturnValue @Override - public boolean put(@ParametricNullness K key, @ParametricNullness V value) { + public boolean put(@Mutable AbstractListMultimap this, @ParametricNullness K key, @ParametricNullness V value) { return super.put(key, value); } @@ -128,7 +134,7 @@ public boolean put(@ParametricNullness K key, @ParametricNullness V value) { * values. */ @Override - public Map> asMap() { + public @PolyMutable Map> asMap(@PolyMutable AbstractListMultimap this) { return super.asMap(); } @@ -140,7 +146,7 @@ public Map> asMap() { */ @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@Readonly AbstractListMultimap this, @CheckForNull @Readonly Object object) { return super.equals(object); } diff --git a/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java b/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java index 16f9cadc337e..cc1227593e36 100644 --- a/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java +++ b/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java @@ -48,7 +48,14 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * Basic implementation of the {@link Multimap} interface. This class represents a multimap as a map @@ -88,9 +95,11 @@ * @author Jared Levy * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class AbstractMapBasedMultimap +@ReceiverDependentMutable +abstract class AbstractMapBasedMultimap extends AbstractMultimap implements Serializable { /* * Here's an outline of the overall design. @@ -111,7 +120,7 @@ abstract class AbstractMapBasedMultimap> map; + private transient Map> map; private transient int totalSize; /** @@ -120,13 +129,13 @@ abstract class AbstractMapBasedMultimap> map) { + protected AbstractMapBasedMultimap(@ReceiverDependentMutable Map> map) { checkArgument(map.isEmpty()); this.map = map; } /** Used during deserialization only. */ - final void setMap(Map> map) { + final void setMap(@Mutable AbstractMapBasedMultimap this, Map> map) { this.map = map; totalSize = 0; for (Collection values : map.values()) { @@ -140,7 +149,7 @@ final void setMap(Map> map) { * *

This is used in {@link #removeAll} on an empty key. */ - Collection createUnmodifiableEmptyCollection() { + @Readonly Collection createUnmodifiableEmptyCollection(@Readonly AbstractMapBasedMultimap this) { return unmodifiableCollectionSubclass(createCollection()); } @@ -154,7 +163,7 @@ Collection createUnmodifiableEmptyCollection() { * * @return an empty collection of values */ - abstract Collection createCollection(); + abstract @PolyMutable Collection createCollection(@PolyMutable AbstractMapBasedMultimap this); /** * Creates the collection of values for an explicitly provided key. By default, it simply calls @@ -164,30 +173,30 @@ Collection createUnmodifiableEmptyCollection() { * @param key key to associate with values in the collection * @return an empty collection of values */ - Collection createCollection(@ParametricNullness K key) { + @PolyMutable Collection createCollection(@PolyMutable AbstractMapBasedMultimap this, @ParametricNullness K key) { return createCollection(); } - Map> backingMap() { + @PolyMutable Map> backingMap(@PolyMutable AbstractMapBasedMultimap this) { return map; } // Query Operations @Override - public int size() { + public int size(@Readonly AbstractMapBasedMultimap this) { return totalSize; } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly AbstractMapBasedMultimap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return map.containsKey(key); } // Modification Operations @Override - public boolean put(@ParametricNullness K key, @ParametricNullness V value) { + public boolean put(@Mutable AbstractMapBasedMultimap this, @ParametricNullness K key, @ParametricNullness V value) { Collection collection = map.get(key); if (collection == null) { collection = createCollection(key); @@ -206,7 +215,7 @@ public boolean put(@ParametricNullness K key, @ParametricNullness V value) { } } - private Collection getOrCreateCollection(@ParametricNullness K key) { + private Collection getOrCreateCollection(@Mutable AbstractMapBasedMultimap this, @ParametricNullness K key) { Collection collection = map.get(key); if (collection == null) { collection = createCollection(key); @@ -223,7 +232,7 @@ private Collection getOrCreateCollection(@ParametricNullness K key) { *

The returned collection is immutable. */ @Override - public Collection replaceValues(@ParametricNullness K key, Iterable values) { + public @Readonly Collection replaceValues(@Mutable AbstractMapBasedMultimap this, @ParametricNullness K key, Iterable values) { Iterator iterator = values.iterator(); if (!iterator.hasNext()) { return removeAll(key); @@ -252,7 +261,7 @@ public Collection replaceValues(@ParametricNullness K key, IterableThe returned collection is immutable. */ @Override - public Collection removeAll(@CheckForNull Object key) { + public @Readonly Collection removeAll(@Mutable AbstractMapBasedMultimap this, @CheckForNull @Readonly Object key) { Collection collection = map.remove(key); if (collection == null) { @@ -267,13 +276,14 @@ public Collection removeAll(@CheckForNull Object key) { return unmodifiableCollectionSubclass(output); } - Collection unmodifiableCollectionSubclass( - Collection collection) { + @Readonly Collection unmodifiableCollectionSubclass( + @Readonly AbstractMapBasedMultimap this, + @Readonly Collection collection) { return Collections.unmodifiableCollection(collection); } @Override - public void clear() { + public void clear(@Mutable AbstractMapBasedMultimap this) { // Clear each collection, to make previously returned collections empty. for (Collection collection : map.values()) { collection.clear(); @@ -290,7 +300,7 @@ public void clear() { *

The returned collection is not serializable. */ @Override - public Collection get(@ParametricNullness K key) { + public @PolyMutable Collection get(@PolyMutable AbstractMapBasedMultimap this, @ParametricNullness K key) { Collection collection = map.get(key); if (collection == null) { collection = createCollection(key); @@ -302,15 +312,15 @@ public Collection get(@ParametricNullness K key) { * Generates a decorated collection that remains consistent with the values in the multimap for * the provided key. Changes to the multimap may alter the returned collection, and vice versa. */ - Collection wrapCollection(@ParametricNullness K key, Collection collection) { - return new WrappedCollection(key, collection, null); + @PolyMutable Collection wrapCollection(@PolyMutable AbstractMapBasedMultimap this, @ParametricNullness K key, @PolyMutable Collection collection) { + return new @PolyMutable WrappedCollection(key, collection, null); } - final List wrapList( - @ParametricNullness K key, List list, @CheckForNull WrappedCollection ancestor) { + final @PolyMutable List wrapList( + @ParametricNullness K key, @PolyMutable List list, @CheckForNull WrappedCollection ancestor) { return (list instanceof RandomAccess) - ? new RandomAccessWrappedList(key, list, ancestor) - : new WrappedList(key, list, ancestor); + ? new @PolyMutable RandomAccessWrappedList(key, list, ancestor) + : new @PolyMutable WrappedList(key, list, ancestor); } /** @@ -329,6 +339,7 @@ final List wrapList( * the corresponding methods of the full wrapped collection. */ @WeakOuter + @ReceiverDependentMutable class WrappedCollection extends AbstractCollection { @ParametricNullness final K key; Collection delegate; @@ -337,8 +348,8 @@ class WrappedCollection extends AbstractCollection { WrappedCollection( @ParametricNullness K key, - Collection delegate, - @CheckForNull WrappedCollection ancestor) { + @ReceiverDependentMutable Collection delegate, + @CheckForNull @ReceiverDependentMutable WrappedCollection ancestor) { this.key = key; this.delegate = delegate; this.ancestor = ancestor; @@ -352,7 +363,7 @@ class WrappedCollection extends AbstractCollection { *

For a subcollection, refresh its ancestor and validate that the ancestor delegate hasn't * changed. */ - void refreshIfEmpty() { + void refreshIfEmpty(@Mutable WrappedCollection this) { if (ancestor != null) { ancestor.refreshIfEmpty(); if (ancestor.getDelegate() != ancestorDelegate) { @@ -370,7 +381,7 @@ void refreshIfEmpty() { * If collection is empty, remove it from {@code AbstractMapBasedMultimap.this.map}. For * subcollections, check whether the ancestor collection is empty. */ - void removeIfEmpty() { + void removeIfEmpty(@Mutable WrappedCollection this) { if (ancestor != null) { ancestor.removeIfEmpty(); } else if (delegate.isEmpty()) { @@ -379,7 +390,7 @@ void removeIfEmpty() { } @ParametricNullness - K getKey() { + K getKey(@Readonly WrappedCollection this) { return key; } @@ -389,7 +400,7 @@ K getKey() { * *

Subcollection add the ancestor's delegate instead. */ - void addToMap() { + void addToMap(@Mutable WrappedCollection this) { if (ancestor != null) { ancestor.addToMap(); } else { @@ -398,13 +409,13 @@ void addToMap() { } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly WrappedCollection this) { refreshIfEmpty(); return delegate.size(); } @Override - public boolean equals(@CheckForNull @UnknownSignedness Object object) { + public boolean equals(@Readonly WrappedCollection this, @CheckForNull @UnknownSignedness @Readonly Object object) { if (object == this) { return true; } @@ -413,34 +424,37 @@ public boolean equals(@CheckForNull @UnknownSignedness Object object) { } @Override - public int hashCode(@UnknownSignedness WrappedCollection this) { + public int hashCode(@UnknownSignedness @Readonly WrappedCollection this) { refreshIfEmpty(); return delegate.hashCode(); } @Override - public String toString() { + public String toString(@Readonly WrappedCollection this) { refreshIfEmpty(); return delegate.toString(); } - Collection getDelegate() { + @PolyMutable Collection getDelegate(@PolyMutable WrappedCollection this) { return delegate; } @Override - public Iterator iterator() { + @SuppressWarnings("pico:method.invocation.invalid") // refreshIfEmpty mutates 'this' + public Iterator iterator(@Readonly WrappedCollection this) { refreshIfEmpty(); return new WrappedIterator(); } @Override - public Spliterator spliterator() { + @SuppressWarnings("pico:method.invocation.invalid") // refreshIfEmpty mutates 'this' + public Spliterator spliterator(@Readonly WrappedCollection this) { refreshIfEmpty(); return delegate.spliterator(); } /** Collection iterator for {@code WrappedCollection}. */ + @ReceiverDependentMutable class WrappedIterator implements Iterator { final Iterator delegateIterator; final Collection originalDelegate = delegate; @@ -449,7 +463,7 @@ class WrappedIterator implements Iterator { delegateIterator = iteratorOrListIterator(delegate); } - WrappedIterator(Iterator delegateIterator) { + WrappedIterator(@ReceiverDependentMutable Iterator delegateIterator) { this.delegateIterator = delegateIterator; } @@ -551,7 +565,7 @@ public void clear() { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable @CheckForNull @UnknownSignedness @Readonly Object o) { refreshIfEmpty(); boolean changed = delegate.remove(o); if (changed) { @@ -590,7 +604,7 @@ public boolean retainAll(Collection c) { } } - private static Iterator iteratorOrListIterator( + private static Iterator iteratorOrListIterator( Collection collection) { return (collection instanceof List) ? ((List) collection).listIterator() @@ -599,13 +613,14 @@ public boolean retainAll(Collection c) { /** Set decorator that stays in sync with the multimap values for a key. */ @WeakOuter + @ReceiverDependentMutable class WrappedSet extends WrappedCollection implements Set { - WrappedSet(@ParametricNullness K key, Set delegate) { + WrappedSet(@ParametricNullness K key, @ReceiverDependentMutable Set delegate) { super(key, delegate, null); } @Override - public boolean removeAll(Collection c) { + public boolean removeAll(@Mutable WrappedSet this, @Readonly Collection c) { if (c.isEmpty()) { return false; } @@ -626,11 +641,12 @@ public boolean removeAll(Collection c) { /** SortedSet decorator that stays in sync with the multimap values for a key. */ @WeakOuter + @ReceiverDependentMutable class WrappedSortedSet extends WrappedCollection implements SortedSet { WrappedSortedSet( @ParametricNullness K key, - SortedSet delegate, - @CheckForNull WrappedCollection ancestor) { + @ReceiverDependentMutable SortedSet delegate, + @CheckForNull @ReceiverDependentMutable WrappedCollection ancestor) { super(key, delegate, ancestor); } @@ -687,17 +703,18 @@ public SortedSet tailSet(@ParametricNullness V fromElement) { } @WeakOuter + @ReceiverDependentMutable class WrappedNavigableSet extends WrappedSortedSet implements NavigableSet { WrappedNavigableSet( @ParametricNullness K key, - NavigableSet delegate, - @CheckForNull WrappedCollection ancestor) { + @ReceiverDependentMutable NavigableSet delegate, + @CheckForNull @ReceiverDependentMutable WrappedCollection ancestor) { super(key, delegate, ancestor); } @Override - NavigableSet getSortedSetDelegate() { - return (NavigableSet) super.getSortedSetDelegate(); + @PolyMutable NavigableSet getSortedSetDelegate(@PolyMutable WrappedNavigableSet this) { + return (@PolyMutable NavigableSet) super.getSortedSetDelegate(); } @Override @@ -773,9 +790,10 @@ public NavigableSet tailSet(@ParametricNullness V fromElement, boolean inclus /** List decorator that stays in sync with the multimap values for a key. */ @WeakOuter + @ReceiverDependentMutable class WrappedList extends WrappedCollection implements List { WrappedList( - @ParametricNullness K key, List delegate, @CheckForNull WrappedCollection ancestor) { + @ParametricNullness K key, @ReceiverDependentMutable List delegate, @CheckForNull WrappedCollection ancestor) { super(key, delegate, ancestor); } @@ -869,6 +887,7 @@ public List subList(int fromIndex, int toIndex) { } /** ListIterator decorator. */ + @ReceiverDependentMutable private class WrappedListIterator extends WrappedIterator implements ListIterator { WrappedListIterator() {} @@ -922,31 +941,33 @@ public void add(@ParametricNullness V value) { * List decorator that stays in sync with the multimap values for a key and supports rapid random * access. */ + @ReceiverDependentMutable private class RandomAccessWrappedList extends WrappedList implements RandomAccess { RandomAccessWrappedList( - @ParametricNullness K key, List delegate, @CheckForNull WrappedCollection ancestor) { + @ParametricNullness K key, @ReceiverDependentMutable List delegate, @CheckForNull WrappedCollection ancestor) { super(key, delegate, ancestor); } } @Override - Set createKeySet() { - return new KeySet(map); + @PolyMutable Set createKeySet(@PolyMutable AbstractMapBasedMultimap this) { + return new @PolyMutable KeySet(map); } - final Set createMaybeNavigableKeySet() { + final @PolyMutable Set createMaybeNavigableKeySet(@PolyMutable AbstractMapBasedMultimap this) { if (map instanceof NavigableMap) { - return new NavigableKeySet((NavigableMap>) map); + return new @PolyMutable NavigableKeySet((@PolyMutable NavigableMap>) map); } else if (map instanceof SortedMap) { - return new SortedKeySet((SortedMap>) map); + return new @PolyMutable SortedKeySet((@PolyMutable SortedMap>) map); } else { - return new KeySet(map); + return new @PolyMutable KeySet(map); } } @WeakOuter - private class KeySet extends Maps.KeySet> { - KeySet(final Map> subMap) { + @ReceiverDependentMutable + private class KeySet extends Maps.KeySet> { + KeySet(final @ReceiverDependentMutable Map> subMap) { super(subMap); } @@ -988,7 +1009,7 @@ public Spliterator spliterator() { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object key) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object key) { int count = 0; Collection collection = map().remove(key); if (collection != null) { @@ -1010,17 +1031,18 @@ public boolean containsAll(Collection c) { } @Override - public boolean equals(@CheckForNull @UnknownSignedness Object object) { + public boolean equals(@CheckForNull @UnknownSignedness @Readonly Object object) { return this == object || this.map().keySet().equals(object); } @Override - public int hashCode(@UnknownSignedness KeySet this) { + public int hashCode(@UnknownSignedness @Readonly KeySet this) { return map().keySet().hashCode(); } } @WeakOuter + @ReceiverDependentMutable private class SortedKeySet extends KeySet implements SortedSet { SortedKeySet(SortedMap> subMap) { @@ -1066,6 +1088,7 @@ public SortedSet tailSet(@ParametricNullness K fromElement) { } @WeakOuter + @ReceiverDependentMutable class NavigableKeySet extends SortedKeySet implements NavigableSet { NavigableKeySet(NavigableMap> subMap) { super(subMap); @@ -1160,7 +1183,7 @@ public NavigableSet tailSet(@ParametricNullness K fromElement, boolean inclus } /** Removes all values for the provided key. */ - private void removeValuesForKey(@CheckForNull Object key) { + private void removeValuesForKey(@CheckForNull @Readonly Object key) { Collection collection = Maps.safeRemove(map, key); if (collection != null) { @@ -1170,7 +1193,8 @@ private void removeValuesForKey(@CheckForNull Object key) { } } - private abstract class Itr implements Iterator { + @ReceiverDependentMutable + private abstract class Itr implements Iterator { final Iterator>> keyIterator; @CheckForNull K key; @CheckForNull Collection collection; @@ -1226,17 +1250,18 @@ public void remove() { * by the values of a second key, and so on. */ @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable AbstractMapBasedMultimap this) { return super.values(); } @Override - Collection createValues() { + @PolyMutable Collection createValues(@PolyMutable AbstractMapBasedMultimap this) { return new Values(); } @Override - Iterator valueIterator() { + @CFComment("PICO: follow super's polymutable") + Iterator valueIterator(@PolyMutable AbstractMapBasedMultimap this) { return new Itr() { @Override @ParametricNullness @@ -1247,7 +1272,8 @@ V output(@ParametricNullness K key, @ParametricNullness V value) { } @Override - Spliterator valueSpliterator() { + @CFComment("PICO: follow super's polymutable") + Spliterator valueSpliterator(@PolyMutable AbstractMapBasedMultimap this) { return CollectSpliterators.flatMap( map.values().spliterator(), Collection::spliterator, Spliterator.SIZED, size()); } @@ -1259,7 +1285,7 @@ Spliterator valueSpliterator() { */ @Override - Multiset createKeys() { + @PolyMutable Multiset createKeys(@PolyMutable AbstractMapBasedMultimap this) { return new Multimaps.Keys(this); } @@ -1273,12 +1299,12 @@ Multiset createKeys() { * time the entry is returned by a method call to the collection or its iterator. */ @Override - public Collection> entries() { + public @PolyMutable Collection<@PolyMutable Entry> entries(@PolyMutable AbstractMapBasedMultimap this) { return super.entries(); } @Override - Collection> createEntries() { + @PolyMutable Collection<@PolyMutable Entry> createEntries(@PolyMutable AbstractMapBasedMultimap this) { if (this instanceof SetMultimap) { return new EntrySet(); } else { @@ -1295,17 +1321,17 @@ Collection> createEntries() { * @return an iterator across map entries */ @Override - Iterator> entryIterator() { - return new Itr>() { + Iterator<@PolyMutable Entry> entryIterator(@PolyMutable AbstractMapBasedMultimap this) { + return new Itr<@PolyMutable Entry>() { @Override - Entry output(@ParametricNullness K key, @ParametricNullness V value) { + @Immutable Entry output(@ParametricNullness K key, @ParametricNullness V value) { return Maps.immutableEntry(key, value); } }; } @Override - Spliterator> entrySpliterator() { + Spliterator<@PolyMutable Entry> entrySpliterator(@PolyMutable AbstractMapBasedMultimap this) { return CollectSpliterators.flatMap( map.entrySet().spliterator(), keyToValueCollectionEntry -> { @@ -1326,11 +1352,11 @@ public void forEach(BiConsumer action) { } @Override - Map> createAsMap() { + @PolyMutable Map> createAsMap(@PolyMutable AbstractMapBasedMultimap this) { return new AsMap(map); } - final Map> createMaybeNavigableAsMap() { + final Map> createMaybeNavigableAsMap(@PolyMutable AbstractMapBasedMultimap this) { if (map instanceof NavigableMap) { return new NavigableAsMap((NavigableMap>) map); } else if (map instanceof SortedMap) { @@ -1341,32 +1367,33 @@ final Map> createMaybeNavigableAsMap() { } @WeakOuter + @ReceiverDependentMutable private class AsMap extends ViewCachingAbstractMap> { /** * Usually the same as map, but smaller for the headMap(), tailMap(), or subMap() of a * SortedAsMap. */ - final transient Map> submap; + final transient Map> submap; - AsMap(Map> submap) { + AsMap(@ReceiverDependentMutable Map> submap) { this.submap = submap; } @Override - protected Set>> createEntrySet() { + protected @PolyMutable Set<@PolyMutable Entry>> createEntrySet(@PolyMutable AsMap this) { return new AsMapEntries(); } // The following methods are included for performance. @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly AsMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return Maps.safeContainsKey(submap, key); } @Override @CheckForNull - public Collection get(@CheckForNull @UnknownSignedness Object key) { + public @PolyMutable Collection get(@PolyMutable AsMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { Collection collection = Maps.safeGet(submap, key); if (collection == null) { return null; @@ -1377,18 +1404,18 @@ public Collection get(@CheckForNull @UnknownSignedness Object key) { } @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable AsMap this) { return AbstractMapBasedMultimap.this.keySet(); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly AsMap this) { return submap.size(); } @Override @CheckForNull - public Collection remove(@CheckForNull @UnknownSignedness Object key) { + public Collection remove(@Mutable AsMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { Collection collection = submap.remove(key); if (collection == null) { return null; @@ -1402,22 +1429,22 @@ public Collection remove(@CheckForNull @UnknownSignedness Object key) { } @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@Readonly AsMap this, @CheckForNull @Readonly Object object) { return this == object || submap.equals(object); } @Override - public int hashCode(@UnknownSignedness AsMap this) { + public int hashCode(@UnknownSignedness @Readonly AsMap this) { return submap.hashCode(); } @Override - public String toString() { + public String toString(@Readonly AsMap this) { return submap.toString(); } @Override - public void clear() { + public void clear(@Mutable AsMap this) { if (submap == map) { AbstractMapBasedMultimap.this.clear(); } else { @@ -1425,20 +1452,21 @@ public void clear() { } } - Entry> wrapEntry(Entry> entry) { + @Immutable Entry> wrapEntry(Entry> entry) { K key = entry.getKey(); return Maps.immutableEntry(key, wrapCollection(key, entry.getValue())); } @WeakOuter - class AsMapEntries extends Maps.EntrySet> { + @ReceiverDependentMutable + class AsMapEntries extends Maps.EntrySet> { @Override - Map> map() { + @PolyMutable Map> map(@PolyMutable AsMapEntries this) { return AsMap.this; } @Override - public Iterator>> iterator() { + public Iterator>> iterator(@PolyMutable AsMapEntries this) { return new AsMapIterator(); } @@ -1450,12 +1478,12 @@ public Spliterator>> spliterator() { // The following methods are included for performance. @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object o) { return Collections2.safeContains(submap.entrySet(), o); } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object o) { if (!contains(o)) { return false; } @@ -1495,47 +1523,48 @@ public void remove() { } @WeakOuter + @ReceiverDependentMutable private class SortedAsMap extends AsMap implements SortedMap> { - SortedAsMap(SortedMap> submap) { + SortedAsMap(@ReceiverDependentMutable SortedMap> submap) { super(submap); } - SortedMap> sortedMap() { - return (SortedMap>) submap; + @PolyMutable SortedMap> sortedMap(@PolyMutable SortedAsMap this) { + return (@PolyMutable SortedMap>) submap; } @Override @CheckForNull - public Comparator comparator() { + public Comparator comparator(@Readonly SortedAsMap this) { return sortedMap().comparator(); } @Override @ParametricNullness - public @KeyFor("this") K firstKey() { + public @KeyFor("this") K firstKey(@Readonly SortedAsMap this) { return sortedMap().firstKey(); } @Override @ParametricNullness - public @KeyFor("this") K lastKey() { + public @KeyFor("this") K lastKey(@Readonly SortedAsMap this) { return sortedMap().lastKey(); } @Override - public SortedMap> headMap(@ParametricNullness K toKey) { + public @PolyMutable SortedMap> headMap(@PolyMutable SortedAsMap this, @ParametricNullness K toKey) { return new SortedAsMap(sortedMap().headMap(toKey)); } @Override - public SortedMap> subMap( + public @PolyMutable SortedMap> subMap( @ParametricNullness K fromKey, @ParametricNullness K toKey) { - return new SortedAsMap(sortedMap().subMap(fromKey, toKey)); + return new @PolyMutable SortedAsMap(sortedMap().subMap(fromKey, toKey)); } @Override - public SortedMap> tailMap(@ParametricNullness K fromKey) { - return new SortedAsMap(sortedMap().tailMap(fromKey)); + public @PolyMutable SortedMap> tailMap(@ParametricNullness K fromKey) { + return new @PolyMutable SortedAsMap(sortedMap().tailMap(fromKey)); } @CheckForNull SortedSet sortedKeySet; @@ -1543,108 +1572,109 @@ public SortedMap> tailMap(@ParametricNullness K fromKey) { // returns a SortedSet, even though returning a Set would be sufficient to // satisfy the SortedMap.keySet() interface @Override - public SortedSet<@KeyFor({"this"}) K> keySet() { + public @PolyMutable SortedSet<@KeyFor({"this"}) K> keySet(@PolyMutable SortedAsMap this) { SortedSet result = sortedKeySet; return (result == null) ? sortedKeySet = createKeySet() : result; } @Override - SortedSet createKeySet() { - return new SortedKeySet(sortedMap()); + @PolyMutable SortedSet createKeySet(@PolyMutable SortedAsMap this) { + return new @PolyMutable SortedKeySet(sortedMap()); } } - class NavigableAsMap extends SortedAsMap implements NavigableMap> { + @ReceiverDependentMutable + class NavigableAsMap extends SortedAsMap implements NavigableMap> { - NavigableAsMap(NavigableMap> submap) { + NavigableAsMap(NavigableMap> submap) { super(submap); } @Override - NavigableMap> sortedMap() { - return (NavigableMap>) super.sortedMap(); + NavigableMap> sortedMap(@PolyMutable NavigableAsMap this) { + return (NavigableMap>) super.sortedMap(); } @Override @CheckForNull - public Entry> lowerEntry(@ParametricNullness K key) { - Entry> entry = sortedMap().lowerEntry(key); + public @PolyMutable Entry> lowerEntry(@PolyMutable NavigableAsMap this, @ParametricNullness K key) { + Entry> entry = sortedMap().lowerEntry(key); return (entry == null) ? null : wrapEntry(entry); } @Override @CheckForNull - public K lowerKey(@ParametricNullness K key) { + public K lowerKey(@Readonly NavigableAsMap this, @ParametricNullness K key) { return sortedMap().lowerKey(key); } @Override @CheckForNull - public Entry> floorEntry(@ParametricNullness K key) { - Entry> entry = sortedMap().floorEntry(key); + public @PolyMutable Entry> floorEntry(@PolyMutable NavigableAsMap this, @ParametricNullness K key) { + @PolyMutable Entry> entry = sortedMap().floorEntry(key); return (entry == null) ? null : wrapEntry(entry); } @Override @CheckForNull - public K floorKey(@ParametricNullness K key) { + public K floorKey(@Readonly NavigableAsMap this, @ParametricNullness K key) { return sortedMap().floorKey(key); } @Override @CheckForNull - public Entry> ceilingEntry(@ParametricNullness K key) { - Entry> entry = sortedMap().ceilingEntry(key); + public Entry> ceilingEntry(@PolyMutable NavigableAsMap this, @ParametricNullness K key) { + Entry> entry = sortedMap().ceilingEntry(key); return (entry == null) ? null : wrapEntry(entry); } @Override @CheckForNull - public K ceilingKey(@ParametricNullness K key) { + public K ceilingKey(@Readonly NavigableAsMap this, @ParametricNullness K key) { return sortedMap().ceilingKey(key); } @Override @CheckForNull - public Entry> higherEntry(@ParametricNullness K key) { - Entry> entry = sortedMap().higherEntry(key); + public Entry> higherEntry(@PolyMutable NavigableAsMap this, @ParametricNullness K key) { + Entry> entry = sortedMap().higherEntry(key); return (entry == null) ? null : wrapEntry(entry); } @Override @CheckForNull - public K higherKey(@ParametricNullness K key) { + public K higherKey(@Readonly NavigableAsMap this, @ParametricNullness K key) { return sortedMap().higherKey(key); } @Override @CheckForNull - public Entry> firstEntry() { - Entry> entry = sortedMap().firstEntry(); + public Entry> firstEntry(@PolyMutable NavigableAsMap this) { + Entry> entry = sortedMap().firstEntry(); return (entry == null) ? null : wrapEntry(entry); } @Override @CheckForNull - public Entry> lastEntry() { - Entry> entry = sortedMap().lastEntry(); + public Entry> lastEntry(@PolyMutable NavigableAsMap this) { + Entry> entry = sortedMap().lastEntry(); return (entry == null) ? null : wrapEntry(entry); } @Override @CheckForNull - public Entry> pollFirstEntry() { + public @Immutable Entry> pollFirstEntry(@Mutable NavigableAsMap this) { return pollAsMapEntry(entrySet().iterator()); } @Override @CheckForNull - public Entry> pollLastEntry() { + public @Immutable Entry> pollLastEntry(@Mutable NavigableAsMap this) { return pollAsMapEntry(descendingMap().entrySet().iterator()); } @CheckForNull - Entry> pollAsMapEntry(Iterator>> entryIterator) { + @Immutable Entry> pollAsMapEntry(@Mutable NavigableAsMap this, Iterator>> entryIterator) { if (!entryIterator.hasNext()) { return null; } @@ -1656,64 +1686,67 @@ Entry> pollAsMapEntry(Iterator>> entryIt } @Override - public NavigableMap> descendingMap() { - return new NavigableAsMap(sortedMap().descendingMap()); + public @PolyMutable NavigableMap> descendingMap(@PolyMutable NavigableAsMap this) { + return new @PolyMutable NavigableAsMap(sortedMap().descendingMap()); } @Override - public NavigableSet<@KeyFor({"this"}) K> keySet() { - return (NavigableSet) super.keySet(); + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> keySet(@PolyMutable NavigableAsMap this) { + return (@PolyMutable NavigableSet) super.keySet(); } @Override - NavigableSet createKeySet() { - return new NavigableKeySet(sortedMap()); + @PolyMutable NavigableSet createKeySet(@PolyMutable NavigableAsMap this) { + return new @PolyMutable NavigableKeySet(sortedMap()); } @Override - public NavigableSet<@KeyFor({"this"}) K> navigableKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> navigableKeySet(@PolyMutable NavigableAsMap this) { return keySet(); } @Override - public NavigableSet<@KeyFor({"this"}) K> descendingKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> descendingKeySet(@PolyMutable NavigableAsMap this) { return descendingMap().navigableKeySet(); } @Override - public NavigableMap> subMap( + public @PolyMutable NavigableMap> subMap( + @PolyMutable NavigableAsMap this, @ParametricNullness K fromKey, @ParametricNullness K toKey) { return subMap(fromKey, true, toKey, false); } @Override - public NavigableMap> subMap( + public @PolyMutable NavigableMap> subMap( + @PolyMutable NavigableAsMap this, @ParametricNullness K fromKey, boolean fromInclusive, @ParametricNullness K toKey, boolean toInclusive) { - return new NavigableAsMap(sortedMap().subMap(fromKey, fromInclusive, toKey, toInclusive)); + return new @PolyMutable NavigableAsMap(sortedMap().subMap(fromKey, fromInclusive, toKey, toInclusive)); } @Override - public NavigableMap> headMap(@ParametricNullness K toKey) { + public @PolyMutable NavigableMap> headMap(@PolyMutable NavigableAsMap this, @ParametricNullness K toKey) { return headMap(toKey, false); } @Override - public NavigableMap> headMap(@ParametricNullness K toKey, boolean inclusive) { - return new NavigableAsMap(sortedMap().headMap(toKey, inclusive)); + public @PolyMutable NavigableMap> headMap(@PolyMutable NavigableAsMap this, @ParametricNullness K toKey, boolean inclusive) { + return new @PolyMutable NavigableAsMap(sortedMap().headMap(toKey, inclusive)); } @Override - public NavigableMap> tailMap(@ParametricNullness K fromKey) { + public @PolyMutable NavigableMap> tailMap(@PolyMutable NavigableAsMap this, @ParametricNullness K fromKey) { return tailMap(fromKey, true); } @Override - public NavigableMap> tailMap( + public @PolyMutable NavigableMap> tailMap( + @PolyMutable NavigableAsMap this, @ParametricNullness K fromKey, boolean inclusive) { - return new NavigableAsMap(sortedMap().tailMap(fromKey, inclusive)); + return new @PolyMutable NavigableAsMap(sortedMap().tailMap(fromKey, inclusive)); } } diff --git a/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java b/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java index 10f52a9edafd..81c0e7d2a167 100644 --- a/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java +++ b/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java @@ -38,6 +38,10 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -54,7 +58,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -abstract class AbstractMapBasedMultiset extends AbstractMultiset +@ReceiverDependentMutable +abstract class AbstractMapBasedMultiset extends AbstractMultiset implements Serializable { // TODO(lowasser): consider overhauling this back to Map private transient Map backingMap; @@ -67,13 +72,13 @@ abstract class AbstractMapBasedMultiset extends Abst private transient long size; /** Standard constructor. */ - protected AbstractMapBasedMultiset(Map backingMap) { + protected AbstractMapBasedMultiset(@ReceiverDependentMutable Map backingMap) { checkArgument(backingMap.isEmpty()); this.backingMap = backingMap; } /** Used during deserialization only. The backing map must be empty. */ - void setBackingMap(Map backingMap) { + void setBackingMap(@ReceiverDependentMutable Map backingMap) { this.backingMap = backingMap; } @@ -205,6 +210,7 @@ public Iterator iterator() { * retrieve the Map.Entry entry, which can then be used for * a more efficient remove() call. */ + @ReceiverDependentMutable private class MapBasedMultisetIterator implements Iterator { final Iterator> entryIterator; @CheckForNull Map.Entry currentEntry; @@ -256,7 +262,7 @@ public void remove() { } @Override - public @NonNegative int count(@CheckForNull @UnknownSignedness Object element) { + public @NonNegative int count(@Readonly AbstractMapBasedMultiset this, @CheckForNull @UnknownSignedness @Readonly Object element) { Count frequency = Maps.safeGet(backingMap, element); return (frequency == null) ? 0 : frequency.get(); } @@ -271,7 +277,7 @@ public void remove() { */ @CanIgnoreReturnValue @Override - public int add(@ParametricNullness E element, int occurrences) { + public int add(@Mutable AbstractMapBasedMultiset this, @ParametricNullness E element, int occurrences) { if (occurrences == 0) { return count(element); } @@ -293,7 +299,7 @@ public int add(@ParametricNullness E element, int occurrences) { @CanIgnoreReturnValue @Override - public int remove(@CheckForNull Object element, int occurrences) { + public int remove(@Mutable AbstractMapBasedMultiset this, @CheckForNull @Readonly Object element, int occurrences) { if (occurrences == 0) { return count(element); } @@ -321,7 +327,7 @@ public int remove(@CheckForNull Object element, int occurrences) { // Roughly a 33% performance improvement over AbstractMultiset.setCount(). @CanIgnoreReturnValue @Override - public int setCount(@ParametricNullness E element, int count) { + public int setCount(@Mutable AbstractMapBasedMultiset this, @ParametricNullness E element, int count) { checkNonnegative(count, "count"); Count existingCounter; diff --git a/guava/src/com/google/common/collect/AbstractMapEntry.java b/guava/src/com/google/common/collect/AbstractMapEntry.java index 5819710f3c5a..62501ddfbe13 100644 --- a/guava/src/com/google/common/collect/AbstractMapEntry.java +++ b/guava/src/com/google/common/collect/AbstractMapEntry.java @@ -22,6 +22,10 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -31,31 +35,32 @@ * * @author Jared Levy */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class AbstractMapEntry +@ReceiverDependentMutable +abstract class AbstractMapEntry implements Entry { @Pure @Override @ParametricNullness - public abstract K getKey(); + public abstract K getKey(@Readonly AbstractMapEntry this); @Pure @Override @ParametricNullness - public abstract V getValue(); + public abstract V getValue(@Readonly AbstractMapEntry this); @Override @ParametricNullness - public V setValue(@ParametricNullness V value) { + public V setValue(@Mutable AbstractMapEntry this, @ParametricNullness V value) { throw new UnsupportedOperationException(); } @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@Readonly AbstractMapEntry this, @CheckForNull @Readonly Object object) { if (object instanceof Entry) { Entry that = (Entry) object; return Objects.equal(this.getKey(), that.getKey()) @@ -66,7 +71,7 @@ public boolean equals(@CheckForNull Object object) { @Pure @Override - public int hashCode(@UnknownSignedness AbstractMapEntry this) { + public int hashCode(@UnknownSignedness @Readonly AbstractMapEntry this) { K k = getKey(); V v = getValue(); return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode()); @@ -75,7 +80,7 @@ public int hashCode(@UnknownSignedness AbstractMapEntry this) { /** Returns a string representation of the form {@code {key}={value}}. */ @Pure @Override - public String toString() { + public String toString(@Readonly AbstractMapEntry this) { return getKey() + "=" + getValue(); } } diff --git a/guava/src/com/google/common/collect/AbstractMultimap.java b/guava/src/com/google/common/collect/AbstractMultimap.java index db5a67f88e80..d8ddb398da09 100644 --- a/guava/src/com/google/common/collect/AbstractMultimap.java +++ b/guava/src/com/google/common/collect/AbstractMultimap.java @@ -34,29 +34,37 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * A skeleton {@code Multimap} implementation, not necessarily in terms of a {@code Map}. * * @author Louis Wasserman */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class AbstractMultimap +@ReceiverDependentMutable +abstract class AbstractMultimap implements Multimap { @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly AbstractMultimap this) { return size() == 0; } @Pure @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly AbstractMultimap this, @CheckForNull @UnknownSignedness @Readonly Object value) { for (Collection collection : asMap().values()) { if (collection.contains(value)) { return true; @@ -68,27 +76,27 @@ public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { @Pure @Override - public boolean containsEntry(@CheckForNull Object key, @CheckForNull Object value) { + public boolean containsEntry(@Readonly AbstractMultimap this, @CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { Collection collection = asMap().get(key); return collection != null && collection.contains(value); } @CanIgnoreReturnValue @Override - public boolean remove(@CheckForNull Object key, @CheckForNull Object value) { + public boolean remove(@Mutable AbstractMultimap this, @CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { Collection collection = asMap().get(key); return collection != null && collection.remove(value); } @CanIgnoreReturnValue @Override - public boolean put(@ParametricNullness K key, @ParametricNullness V value) { + public boolean put(@Mutable AbstractMultimap this, @ParametricNullness K key, @ParametricNullness V value) { return get(key).add(value); } @CanIgnoreReturnValue @Override - public boolean putAll(@ParametricNullness K key, Iterable values) { + public boolean putAll(@Mutable AbstractMultimap this, @ParametricNullness K key, Iterable values) { checkNotNull(values); // make sure we only call values.iterator() once // and we only call get(key) if values is nonempty @@ -103,7 +111,7 @@ public boolean putAll(@ParametricNullness K key, Iterable values) { @CanIgnoreReturnValue @Override - public boolean putAll(Multimap multimap) { + public boolean putAll(@Mutable AbstractMultimap this, Multimap multimap) { boolean changed = false; for (Entry entry : multimap.entries()) { changed |= put(entry.getKey(), entry.getValue()); @@ -113,150 +121,157 @@ public boolean putAll(Multimap multimap) { @CanIgnoreReturnValue @Override - public Collection replaceValues(@ParametricNullness K key, Iterable values) { + public Collection replaceValues(@Mutable AbstractMultimap this, @ParametricNullness K key, Iterable values) { checkNotNull(values); Collection result = removeAll(key); putAll(key, values); return result; } - @LazyInit @CheckForNull private transient Collection> entries; + @CFComment("Change to @LazyFinal later") + @LazyInit @CheckForNull private transient @Assignable Collection<@ReceiverDependentMutable Entry> entries; @SideEffectFree @Override - public Collection> entries() { - Collection> result = entries; + public @PolyMutable Collection<@PolyMutable Entry> entries(@PolyMutable AbstractMultimap this) { + Collection<@PolyMutable Entry> result = entries; return (result == null) ? entries = createEntries() : result; } - abstract Collection> createEntries(); + abstract @PolyMutable Collection<@PolyMutable Entry> createEntries(@PolyMutable AbstractMultimap this); @WeakOuter + @ReceiverDependentMutable class Entries extends Multimaps.Entries { @Override - Multimap multimap() { + @PolyMutable Multimap multimap(@PolyMutable AbstractMultimap.Entries this) { return AbstractMultimap.this; } @Override - public Iterator> iterator() { + public Iterator<@PolyMutable Entry> iterator(@PolyMutable AbstractMultimap.Entries this) { return entryIterator(); } @Override - public Spliterator> spliterator() { + public Spliterator<@PolyMutable Entry> spliterator(@PolyMutable AbstractMultimap.Entries this) { return entrySpliterator(); } } @WeakOuter - class EntrySet extends Entries implements Set> { + @ReceiverDependentMutable + class EntrySet extends Entries implements Set<@ReceiverDependentMutable Entry> { @Pure @Override - public int hashCode(@UnknownSignedness EntrySet this) { + public int hashCode(@UnknownSignedness @Readonly EntrySet this) { return Sets.hashCodeImpl(this); } @Pure @Override - public boolean equals(@CheckForNull @UnknownSignedness Object obj) { + public boolean equals(@Readonly EntrySet this, @CheckForNull @UnknownSignedness @Readonly Object obj) { return Sets.equalsImpl(this, obj); } } - abstract Iterator> entryIterator(); + abstract Iterator<@PolyMutable Entry> entryIterator(@PolyMutable AbstractMultimap this); - Spliterator> entrySpliterator() { + Spliterator<@PolyMutable Entry> entrySpliterator(@PolyMutable AbstractMultimap this) { return Spliterators.spliterator( entryIterator(), size(), (this instanceof SetMultimap) ? Spliterator.DISTINCT : 0); } - @LazyInit @CheckForNull private transient Set keySet; + @CFComment("Change to @LazyFinal later") + @LazyInit @CheckForNull private transient @Assignable Set keySet; @SideEffectFree @Override - public Set keySet() { + public @PolyMutable Set keySet(@PolyMutable AbstractMultimap this) { Set result = keySet; return (result == null) ? keySet = createKeySet() : result; } @SideEffectFree - abstract Set createKeySet(); + abstract @PolyMutable Set createKeySet(@PolyMutable AbstractMultimap this); - @LazyInit @CheckForNull private transient Multiset keys; + @CFComment("Change to @LazyFinal later") + @LazyInit @CheckForNull private transient @Assignable Multiset keys; @Override - public Multiset keys() { + public @PolyMutable Multiset keys(@PolyMutable AbstractMultimap this) { Multiset result = keys; return (result == null) ? keys = createKeys() : result; } - abstract Multiset createKeys(); + abstract @PolyMutable Multiset createKeys(@PolyMutable AbstractMultimap this); - @LazyInit @CheckForNull private transient Collection values; + @CFComment("Change to @LazyFinal later") + @LazyInit @CheckForNull private transient @Assignable Collection values; @SideEffectFree @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable AbstractMultimap this) { Collection result = values; return (result == null) ? values = createValues() : result; } - abstract Collection createValues(); + abstract @PolyMutable Collection createValues(@PolyMutable AbstractMultimap this); @WeakOuter + @ReceiverDependentMutable class Values extends AbstractCollection { @Override - public Iterator iterator() { + public Iterator iterator(@Readonly Values this) { return valueIterator(); } @Pure @Override - public Spliterator spliterator() { + public Spliterator spliterator(@Readonly Values this) { return valueSpliterator(); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly Values this) { return AbstractMultimap.this.size(); } @Pure @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly Values this, @CheckForNull @UnknownSignedness @Readonly Object o) { return AbstractMultimap.this.containsValue(o); } @Override - public void clear() { + public void clear(@Mutable Values this) { AbstractMultimap.this.clear(); } } - Iterator valueIterator() { + Iterator valueIterator(@PolyMutable AbstractMultimap this) { return Maps.valueIterator(entries().iterator()); } - Spliterator valueSpliterator() { + Spliterator valueSpliterator(@PolyMutable AbstractMultimap this) { return Spliterators.spliterator(valueIterator(), size(), 0); } - @LazyInit @CheckForNull private transient Map> asMap; + @LazyInit @CheckForNull private transient @Assignable Map> asMap; @Override - public Map> asMap() { - Map> result = asMap; + public @PolyMutable Map> asMap(@PolyMutable AbstractMultimap this) { + Map> result = asMap; return (result == null) ? asMap = createAsMap() : result; } - abstract Map> createAsMap(); + abstract @PolyMutable Map> createAsMap(@PolyMutable AbstractMultimap this); // Comparison and hashing @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@Readonly AbstractMultimap this, @CheckForNull @Readonly Object object) { return Multimaps.equalsImpl(this, object); } @@ -270,7 +285,7 @@ public boolean equals(@CheckForNull Object object) { */ @Pure @Override - public int hashCode(@UnknownSignedness AbstractMultimap this) { + public int hashCode(@UnknownSignedness @Readonly AbstractMultimap this) { return asMap().hashCode(); } @@ -282,7 +297,7 @@ public int hashCode(@UnknownSignedness AbstractMultimap this) { */ @Pure @Override - public String toString() { + public String toString(@Readonly AbstractMultimap this) { return asMap().toString(); } } diff --git a/guava/src/com/google/common/collect/AbstractMultiset.java b/guava/src/com/google/common/collect/AbstractMultiset.java index 4266d7a318b1..7fc972efb3bb 100644 --- a/guava/src/com/google/common/collect/AbstractMultiset.java +++ b/guava/src/com/google/common/collect/AbstractMultiset.java @@ -29,10 +29,15 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * This class provides a skeletal implementation of the {@link Multiset} interface. A new multiset @@ -47,60 +52,61 @@ * @author Kevin Bourrillion * @author Louis Wasserman */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class AbstractMultiset extends AbstractCollection +@ReceiverDependentMutable +abstract class AbstractMultiset extends AbstractCollection implements Multiset { // Query Operations @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly AbstractMultiset this) { return entrySet().isEmpty(); } @Pure @Override - public boolean contains(@CheckForNull @UnknownSignedness Object element) { + public boolean contains(@Readonly AbstractMultiset this, @CheckForNull @UnknownSignedness @Readonly Object element) { return count(element) > 0; } // Modification Operations @CanIgnoreReturnValue @Override - public final boolean add(@ParametricNullness E element) { + public final boolean add(@Mutable AbstractMultiset this, @ParametricNullness E element) { add(element, 1); return true; } @CanIgnoreReturnValue @Override - public int add(@ParametricNullness E element, int occurrences) { + public int add(@Mutable AbstractMultiset this, @ParametricNullness E element, int occurrences) { throw new UnsupportedOperationException(); } @CanIgnoreReturnValue @Override - public final boolean remove(@CheckForNull @UnknownSignedness Object element) { + public final boolean remove(@Mutable AbstractMultiset this, @CheckForNull @UnknownSignedness @Readonly Object element) { return remove(element, 1) > 0; } @CanIgnoreReturnValue @Override - public int remove(@CheckForNull Object element, int occurrences) { + public int remove(@Mutable AbstractMultiset this, @CheckForNull @Readonly Object element, int occurrences) { throw new UnsupportedOperationException(); } @CanIgnoreReturnValue @Override - public int setCount(@ParametricNullness E element, int count) { + public int setCount(@Mutable AbstractMultiset this, @ParametricNullness E element, int count) { return setCountImpl(this, element, count); } @CanIgnoreReturnValue @Override - public boolean setCount(@ParametricNullness E element, int oldCount, int newCount) { + public boolean setCount(@Mutable AbstractMultiset this, @ParametricNullness E element, int oldCount, int newCount) { return setCountImpl(this, element, oldCount, newCount); } @@ -114,32 +120,32 @@ public boolean setCount(@ParametricNullness E element, int oldCount, int newCoun */ @CanIgnoreReturnValue @Override - public final boolean addAll(Collection elementsToAdd) { + public final boolean addAll(@Mutable AbstractMultiset this, @Readonly Collection elementsToAdd) { return Multisets.addAllImpl(this, elementsToAdd); } @CanIgnoreReturnValue @Override - public final boolean removeAll(Collection elementsToRemove) { + public final boolean removeAll(@Mutable AbstractMultiset this, @Readonly Collection elementsToRemove) { return Multisets.removeAllImpl(this, elementsToRemove); } @CanIgnoreReturnValue @Override - public final boolean retainAll(Collection elementsToRetain) { + public final boolean retainAll(@Mutable AbstractMultiset this, @Readonly Collection elementsToRetain) { return Multisets.retainAllImpl(this, elementsToRetain); } @Override - public abstract void clear(); + public abstract void clear(@Mutable AbstractMultiset this); // Views - @LazyInit @CheckForNull private transient Set elementSet; + @LazyInit @CheckForNull private transient @Assignable Set elementSet; @SideEffectFree @Override - public Set elementSet() { + public @PolyMutable Set elementSet(@PolyMutable AbstractMultiset this) { Set result = elementSet; if (result == null) { elementSet = result = createElementSet(); @@ -151,31 +157,33 @@ public Set elementSet() { * Creates a new instance of this multiset's element set, which will be returned by {@link * #elementSet()}. */ - Set createElementSet() { - return new ElementSet(); + @PolyMutable Set createElementSet(@PolyMutable AbstractMultiset this) { + return new @PolyMutable ElementSet(); } @WeakOuter + @ReceiverDependentMutable class ElementSet extends Multisets.ElementSet { @Override - Multiset multiset() { + @PolyMutable Multiset multiset(@PolyMutable AbstractMultiset.ElementSet this) { return AbstractMultiset.this; } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly ElementSet this) { return elementIterator(); } } - abstract Iterator elementIterator(); + abstract Iterator elementIterator(@Readonly AbstractMultiset this); - @LazyInit @CheckForNull private transient Set> entrySet; + @CFComment("Change to @LazyFinal later") + @LazyInit @CheckForNull private transient @Assignable Set> entrySet; @SideEffectFree @Override - public Set> entrySet() { - Set> result = entrySet; + public @PolyMutable Set<@PolyMutable Entry> entrySet(@PolyMutable AbstractMultiset this) { + Set<@PolyMutable Entry> result = entrySet; if (result == null) { entrySet = result = createEntrySet(); } @@ -183,30 +191,31 @@ public Set> entrySet() { } @WeakOuter + @ReceiverDependentMutable class EntrySet extends Multisets.EntrySet { @Override - Multiset multiset() { + @PolyMutable Multiset multiset(@PolyMutable AbstractMultiset.EntrySet this) { return AbstractMultiset.this; } @Override - public Iterator> iterator() { + public Iterator<@PolyMutable Entry> iterator(@PolyMutable AbstractMultiset.EntrySet this) { return entryIterator(); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly EntrySet this) { return distinctElements(); } } - Set> createEntrySet() { + @PolyMutable Set<@PolyMutable Entry> createEntrySet(@PolyMutable AbstractMultiset this) { return new EntrySet(); } - abstract Iterator> entryIterator(); + abstract Iterator<@PolyMutable Entry> entryIterator(@PolyMutable AbstractMultiset this); - abstract int distinctElements(); + abstract int distinctElements(@Readonly AbstractMultiset this); // Object methods @@ -218,7 +227,7 @@ Set> createEntrySet() { */ @Pure @Override - public final boolean equals(@CheckForNull @UnknownSignedness Object object) { + public final boolean equals(@Readonly AbstractMultiset this, @CheckForNull @UnknownSignedness @Readonly Object object) { return Multisets.equalsImpl(this, object); } @@ -229,7 +238,7 @@ public final boolean equals(@CheckForNull @UnknownSignedness Object object) { */ @Pure @Override - public final int hashCode(@UnknownSignedness AbstractMultiset this) { + public final int hashCode(@Readonly @UnknownSignedness AbstractMultiset this) { return entrySet().hashCode(); } @@ -241,7 +250,7 @@ public final int hashCode(@UnknownSignedness AbstractMultiset this) { */ @Pure @Override - public final String toString() { + public final String toString(@Readonly AbstractMultiset this) { return entrySet().toString(); } } diff --git a/guava/src/com/google/common/collect/AbstractNavigableMap.java b/guava/src/com/google/common/collect/AbstractNavigableMap.java index 973b533d9dc7..487fed5f21a8 100644 --- a/guava/src/com/google/common/collect/AbstractNavigableMap.java +++ b/guava/src/com/google/common/collect/AbstractNavigableMap.java @@ -27,49 +27,57 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Skeletal implementation of {@link NavigableMap}. * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtIncompatible @ElementTypesAreNonnullByDefault -abstract class AbstractNavigableMap +@ReceiverDependentMutable +abstract class AbstractNavigableMap extends IteratorBasedAbstractMap implements NavigableMap { @Override @CheckForNull - public abstract V get(@CheckForNull @UnknownSignedness Object key); + public abstract V get(@Readonly AbstractNavigableMap this, @CheckForNull @UnknownSignedness @Readonly Object key); @Override @CheckForNull - public Entry firstEntry() { + public @PolyMutable Entry firstEntry(@PolyMutable AbstractNavigableMap this) { return Iterators.getNext(entryIterator(), null); } @Override @CheckForNull - public Entry lastEntry() { + public @PolyMutable Entry lastEntry(@PolyMutable AbstractNavigableMap this) { return Iterators.getNext(descendingEntryIterator(), null); } @Override @CheckForNull - public Entry pollFirstEntry() { + public Entry pollFirstEntry(@Mutable AbstractNavigableMap this) { return Iterators.pollNext(entryIterator()); } @Override @CheckForNull - public Entry pollLastEntry() { + public Entry pollLastEntry(@Mutable AbstractNavigableMap this) { return Iterators.pollNext(descendingEntryIterator()); } @Override @ParametricNullness - public @KeyFor("this") K firstKey() { + public @KeyFor("this") K firstKey(@Readonly AbstractNavigableMap this) { Entry entry = firstEntry(); if (entry == null) { throw new NoSuchElementException(); @@ -80,7 +88,7 @@ public Entry pollLastEntry() { @Override @ParametricNullness - public @KeyFor("this") K lastKey() { + public @KeyFor("this") K lastKey(@Readonly AbstractNavigableMap this) { Entry entry = lastEntry(); if (entry == null) { throw new NoSuchElementException(); @@ -91,97 +99,98 @@ public Entry pollLastEntry() { @Override @CheckForNull - public Entry lowerEntry(@ParametricNullness K key) { + public @PolyMutable Entry lowerEntry(@PolyMutable AbstractNavigableMap this, @ParametricNullness K key) { return headMap(key, false).lastEntry(); } @Override @CheckForNull - public Entry floorEntry(@ParametricNullness K key) { + public @PolyMutable Entry floorEntry(@PolyMutable AbstractNavigableMap this, @ParametricNullness K key) { return headMap(key, true).lastEntry(); } @Override @CheckForNull - public Entry ceilingEntry(@ParametricNullness K key) { + public @PolyMutable Entry ceilingEntry(@PolyMutable AbstractNavigableMap this, @ParametricNullness K key) { return tailMap(key, true).firstEntry(); } @Override @CheckForNull - public Entry higherEntry(@ParametricNullness K key) { + public @PolyMutable Entry higherEntry(@PolyMutable AbstractNavigableMap this, @ParametricNullness K key) { return tailMap(key, false).firstEntry(); } @Override @CheckForNull - public K lowerKey(@ParametricNullness K key) { + public K lowerKey(@Readonly AbstractNavigableMap this, @ParametricNullness K key) { return Maps.keyOrNull(lowerEntry(key)); } @Override @CheckForNull - public K floorKey(@ParametricNullness K key) { + public K floorKey(@Readonly AbstractNavigableMap this, @ParametricNullness K key) { return Maps.keyOrNull(floorEntry(key)); } @Override @CheckForNull - public K ceilingKey(@ParametricNullness K key) { + public K ceilingKey(@Readonly AbstractNavigableMap this, @ParametricNullness K key) { return Maps.keyOrNull(ceilingEntry(key)); } @Override @CheckForNull - public K higherKey(@ParametricNullness K key) { + public K higherKey(@Readonly AbstractNavigableMap this, @ParametricNullness K key) { return Maps.keyOrNull(higherEntry(key)); } - abstract Iterator> descendingEntryIterator(); + abstract Iterator<@PolyMutable Entry> descendingEntryIterator(@PolyMutable AbstractNavigableMap this); @Override - public SortedMap subMap(@ParametricNullness K fromKey, @ParametricNullness K toKey) { + public @PolyMutable SortedMap subMap(@PolyMutable AbstractNavigableMap this, @ParametricNullness K fromKey, @ParametricNullness K toKey) { return subMap(fromKey, true, toKey, false); } @Override - public SortedMap headMap(@ParametricNullness K toKey) { + public @PolyMutable SortedMap headMap(@PolyMutable AbstractNavigableMap this, @ParametricNullness K toKey) { return headMap(toKey, false); } @Override - public SortedMap tailMap(@ParametricNullness K fromKey) { + public @PolyMutable SortedMap tailMap(@PolyMutable AbstractNavigableMap this, @ParametricNullness K fromKey) { return tailMap(fromKey, true); } @Override - public NavigableSet<@KeyFor({"this"}) K> navigableKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> navigableKeySet(@PolyMutable AbstractNavigableMap this) { return new Maps.NavigableKeySet<>(this); } @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable AbstractNavigableMap this) { return navigableKeySet(); } @Override - public NavigableSet<@KeyFor({"this"}) K> descendingKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> descendingKeySet(@PolyMutable AbstractNavigableMap this) { return descendingMap().navigableKeySet(); } @Override - public NavigableMap descendingMap() { - return new DescendingMap(); + public @PolyMutable NavigableMap descendingMap(@PolyMutable AbstractNavigableMap this) { + return new @PolyMutable DescendingMap(); } + @ReceiverDependentMutable private final class DescendingMap extends Maps.DescendingMap { @Override - NavigableMap forward() { + @PolyMutable NavigableMap forward(@PolyMutable AbstractNavigableMap.DescendingMap this) { return AbstractNavigableMap.this; } @Override - Iterator> entryIterator() { + Iterator<@PolyMutable Entry> entryIterator(@PolyMutable AbstractNavigableMap.DescendingMap this) { return descendingEntryIterator(); } } diff --git a/guava/src/com/google/common/collect/AbstractRangeSet.java b/guava/src/com/google/common/collect/AbstractRangeSet.java index 69a93db47e11..f77d63c3f00f 100644 --- a/guava/src/com/google/common/collect/AbstractRangeSet.java +++ b/guava/src/com/google/common/collect/AbstractRangeSet.java @@ -16,72 +16,78 @@ import com.google.common.annotations.GwtIncompatible; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A skeletal implementation of {@code RangeSet}. * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtIncompatible @ElementTypesAreNonnullByDefault -abstract class AbstractRangeSet implements RangeSet { +@ReceiverDependentMutable +abstract class AbstractRangeSet implements RangeSet { AbstractRangeSet() {} @Override - public boolean contains(C value) { + public boolean contains(@Readonly AbstractRangeSet this, C value) { return rangeContaining(value) != null; } @Override @CheckForNull - public abstract Range rangeContaining(C value); + public abstract Range rangeContaining(@Readonly AbstractRangeSet this, C value); @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly AbstractRangeSet this) { return asRanges().isEmpty(); } @Override - public void add(Range range) { + public void add(@Mutable AbstractRangeSet this, @Readonly Range range) { throw new UnsupportedOperationException(); } @Override - public void remove(Range range) { + public void remove(@Mutable AbstractRangeSet this, @Readonly Range range) { throw new UnsupportedOperationException(); } @Override - public void clear() { + public void clear(@Mutable AbstractRangeSet this) { remove(Range.all()); } @Override - public boolean enclosesAll(RangeSet other) { + public boolean enclosesAll(@Mutable AbstractRangeSet this, @Readonly RangeSet other) { return enclosesAll(other.asRanges()); } @Override - public void addAll(RangeSet other) { + public void addAll(@Mutable AbstractRangeSet this, @Readonly RangeSet other) { addAll(other.asRanges()); } @Override - public void removeAll(RangeSet other) { + public void removeAll(@Mutable AbstractRangeSet this, @Readonly RangeSet other) { removeAll(other.asRanges()); } @Override - public boolean intersects(Range otherRange) { + public boolean intersects(@Mutable AbstractRangeSet this, @Readonly Range otherRange) { return !subRangeSet(otherRange).isEmpty(); } @Override - public abstract boolean encloses(Range otherRange); + public abstract boolean encloses(@Mutable AbstractRangeSet this, @Readonly Range otherRange); @Override - public boolean equals(@CheckForNull Object obj) { + public boolean equals(@Readonly AbstractRangeSet this, @CheckForNull @Readonly Object obj) { if (obj == this) { return true; } else if (obj instanceof RangeSet) { @@ -92,12 +98,12 @@ public boolean equals(@CheckForNull Object obj) { } @Override - public final int hashCode(@UnknownSignedness AbstractRangeSet this) { + public final int hashCode(@UnknownSignedness @Readonly AbstractRangeSet this) { return asRanges().hashCode(); } @Override - public final String toString() { + public final String toString(@Readonly AbstractRangeSet this) { return asRanges().toString(); } } diff --git a/guava/src/com/google/common/collect/AbstractSequentialIterator.java b/guava/src/com/google/common/collect/AbstractSequentialIterator.java index 172fe356cb78..ccb27a08d04b 100644 --- a/guava/src/com/google/common/collect/AbstractSequentialIterator.java +++ b/guava/src/com/google/common/collect/AbstractSequentialIterator.java @@ -20,6 +20,9 @@ import java.util.NoSuchElementException; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.CFComment; + /** * This class provides a skeletal implementation of the {@code Iterator} interface for sequences * whose next element can always be derived from the previous element. Null elements are not @@ -41,6 +44,8 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault +@CFComment("AOSEN: Is this a design issue?") +@ReceiverDependentMutable public abstract class AbstractSequentialIterator extends UnmodifiableIterator { @CheckForNull private T nextOrNull; diff --git a/guava/src/com/google/common/collect/AbstractSetMultimap.java b/guava/src/com/google/common/collect/AbstractSetMultimap.java index 00b2603d9e5b..c1c673a07e76 100644 --- a/guava/src/com/google/common/collect/AbstractSetMultimap.java +++ b/guava/src/com/google/common/collect/AbstractSetMultimap.java @@ -25,6 +25,11 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; @@ -36,31 +41,32 @@ * * @author Jared Levy */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class AbstractSetMultimap +@ReceiverDependentMutable +abstract class AbstractSetMultimap extends AbstractMapBasedMultimap implements SetMultimap { /** * Creates a new multimap that uses the provided map. * * @param map place to store the mapping from each key to its corresponding values */ - protected AbstractSetMultimap(Map> map) { + protected AbstractSetMultimap(@ReceiverDependentMutable Map> map) { super(map); } @Override - abstract Set createCollection(); + abstract @PolyMutable Set createCollection(@PolyMutable AbstractSetMultimap this); @Override - Set createUnmodifiableEmptyCollection() { + @Readonly Set createUnmodifiableEmptyCollection() { return Collections.emptySet(); } @Override - Collection unmodifiableCollectionSubclass( - Collection collection) { + @Readonly Collection unmodifiableCollectionSubclass( + @Readonly Collection collection) { return Collections.unmodifiableSet((Set) collection); } @@ -78,8 +84,8 @@ Collection wrapCollection(@ParametricNullness K key, Collection collection * {@link Set}, instead of the {@link Collection} specified in the {@link Multimap} interface. */ @Override - public Set get(@ParametricNullness K key) { - return (Set) super.get(key); + public @PolyMutable Set get(@PolyMutable AbstractSetMultimap this, @ParametricNullness K key) { + return (@PolyMutable Set) super.get(key); } /** @@ -90,8 +96,8 @@ public Set get(@ParametricNullness K key) { */ @SideEffectFree @Override - public Set> entries() { - return (Set>) super.entries(); + public @PolyMutable Set<@PolyMutable Entry> entries(@PolyMutable AbstractSetMultimap this) { + return (@PolyMutable Set<@PolyMutable Entry>) super.entries(); } /** @@ -102,8 +108,8 @@ public Set> entries() { */ @CanIgnoreReturnValue @Override - public Set removeAll(@CheckForNull Object key) { - return (Set) super.removeAll(key); + public @Readonly Set removeAll(@Mutable AbstractSetMultimap this, @CheckForNull @Readonly Object key) { + return (@Readonly Set) super.removeAll(key); } /** @@ -116,8 +122,8 @@ public Set removeAll(@CheckForNull Object key) { */ @CanIgnoreReturnValue @Override - public Set replaceValues(@ParametricNullness K key, Iterable values) { - return (Set) super.replaceValues(key, values); + public @Readonly Set replaceValues(@Mutable AbstractSetMultimap this, @ParametricNullness K key, Iterable values) { + return (@Readonly Set) super.replaceValues(key, values); } /** @@ -127,7 +133,7 @@ public Set replaceValues(@ParametricNullness K key, Iterable val * values. */ @Override - public Map> asMap() { + public @PolyMutable Map> asMap(@PolyMutable AbstractSetMultimap this) { return super.asMap(); } @@ -141,7 +147,7 @@ public Map> asMap() { */ @CanIgnoreReturnValue @Override - public boolean put(@ParametricNullness K key, @ParametricNullness V value) { + public boolean put(@Mutable AbstractSetMultimap this, @ParametricNullness K key, @ParametricNullness V value) { return super.put(key, value); } @@ -153,7 +159,7 @@ public boolean put(@ParametricNullness K key, @ParametricNullness V value) { */ @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@Readonly AbstractSetMultimap this, @CheckForNull @Readonly Object object) { return super.equals(object); } diff --git a/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java b/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java index c2a0d06bd96b..e281c09749e7 100644 --- a/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java +++ b/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java @@ -23,6 +23,11 @@ import java.util.SortedSet; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Basic implementation of a {@link SortedSetMultimap} with a sorted key set. @@ -32,33 +37,35 @@ * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault +@ReceiverDependentMutable abstract class AbstractSortedKeySortedSetMultimap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends AbstractSortedSetMultimap { - AbstractSortedKeySortedSetMultimap(SortedMap> map) { + AbstractSortedKeySortedSetMultimap(@ReceiverDependentMutable SortedMap> map) { super(map); } @Override - public SortedMap> asMap() { - return (SortedMap>) super.asMap(); + public @PolyMutable SortedMap> asMap(@PolyMutable AbstractSortedKeySortedSetMultimap this) { + return (@PolyMutable SortedMap>) super.asMap(); } @Override - SortedMap> backingMap() { - return (SortedMap>) super.backingMap(); + @PolyMutable SortedMap> backingMap(@PolyMutable AbstractSortedKeySortedSetMultimap this) { + return (@PolyMutable SortedMap>) super.backingMap(); } @Override - public SortedSet keySet() { - return (SortedSet) super.keySet(); + public @PolyMutable SortedSet keySet(@PolyMutable AbstractSortedKeySortedSetMultimap this) { + return (@PolyMutable SortedSet) super.keySet(); } @Override - Set createKeySet() { + @PolyMutable Set createKeySet(@PolyMutable AbstractSortedKeySortedSetMultimap this) { return createMaybeNavigableKeySet(); } } diff --git a/guava/src/com/google/common/collect/AbstractSortedMultiset.java b/guava/src/com/google/common/collect/AbstractSortedMultiset.java index 621e8f98a5e2..f9e5033d84cf 100644 --- a/guava/src/com/google/common/collect/AbstractSortedMultiset.java +++ b/guava/src/com/google/common/collect/AbstractSortedMultiset.java @@ -23,6 +23,8 @@ import java.util.NavigableSet; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * This class provides a skeletal implementation of the {@link SortedMultiset} interface. @@ -35,7 +37,8 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -abstract class AbstractSortedMultiset extends AbstractMultiset +@ReceiverDependentMutable +abstract class AbstractSortedMultiset extends AbstractMultiset implements SortedMultiset { @GwtTransient final Comparator comparator; diff --git a/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java b/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java index 9dc81b1b8057..017381269e8a 100644 --- a/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java +++ b/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java @@ -25,6 +25,11 @@ import java.util.SortedSet; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; @@ -35,31 +40,32 @@ * * @author Jared Levy */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class AbstractSortedSetMultimap +@ReceiverDependentMutable +abstract class AbstractSortedSetMultimap extends AbstractSetMultimap implements SortedSetMultimap { /** * Creates a new multimap that uses the provided map. * * @param map place to store the mapping from each key to its corresponding values */ - protected AbstractSortedSetMultimap(Map> map) { + protected AbstractSortedSetMultimap(@ReceiverDependentMutable Map> map) { super(map); } @Override - abstract SortedSet createCollection(); + abstract @PolyMutable SortedSet createCollection(@PolyMutable AbstractSortedSetMultimap this); @Override - SortedSet createUnmodifiableEmptyCollection() { + @Readonly SortedSet createUnmodifiableEmptyCollection(@Readonly AbstractSortedSetMultimap this) { return unmodifiableCollectionSubclass(createCollection()); } @Override - SortedSet unmodifiableCollectionSubclass( - Collection collection) { + @Readonly SortedSet unmodifiableCollectionSubclass( + @Readonly Collection collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet) collection); } else { @@ -89,8 +95,8 @@ Collection wrapCollection(@ParametricNullness K key, Collection collection * Multimap} interface. */ @Override - public SortedSet get(@ParametricNullness K key) { - return (SortedSet) super.get(key); + public @PolyMutable SortedSet get(@PolyMutable AbstractSortedSetMultimap this, @ParametricNullness K key) { + return (@PolyMutable SortedSet) super.get(key); } /** @@ -102,8 +108,8 @@ public SortedSet get(@ParametricNullness K key) { */ @CanIgnoreReturnValue @Override - public SortedSet removeAll(@CheckForNull Object key) { - return (SortedSet) super.removeAll(key); + public @Readonly SortedSet removeAll(@Mutable AbstractSortedSetMultimap this, @CheckForNull @Readonly Object key) { + return (@Readonly SortedSet) super.removeAll(key); } /** @@ -118,8 +124,8 @@ public SortedSet removeAll(@CheckForNull Object key) { */ @CanIgnoreReturnValue @Override - public SortedSet replaceValues(@ParametricNullness K key, Iterable values) { - return (SortedSet) super.replaceValues(key, values); + public @Readonly SortedSet replaceValues(@Mutable AbstractSortedSetMultimap this, @ParametricNullness K key, Iterable values) { + return (@Readonly SortedSet) super.replaceValues(key, values); } /** @@ -135,7 +141,7 @@ public SortedSet replaceValues(@ParametricNullness K key, Iterable> asMap() { + public @PolyMutable Map> asMap(@PolyMutable AbstractSortedSetMultimap this) { return super.asMap(); } @@ -147,7 +153,7 @@ public Map> asMap() { */ @SideEffectFree @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable AbstractSortedSetMultimap this) { return super.values(); } diff --git a/guava/src/com/google/common/collect/AbstractTable.java b/guava/src/com/google/common/collect/AbstractTable.java index 97ce8fbeffcf..cca1d930f857 100644 --- a/guava/src/com/google/common/collect/AbstractTable.java +++ b/guava/src/com/google/common/collect/AbstractTable.java @@ -28,41 +28,51 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * Skeletal, implementation-agnostic implementation of the {@link Table} interface. * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault +@ReceiverDependentMutable abstract class AbstractTable< - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Readonly @Nullable Object> implements Table { @Override - public boolean containsRow(@CheckForNull Object rowKey) { + public boolean containsRow(@Readonly AbstractTable this, @CheckForNull @Readonly Object rowKey) { return Maps.safeContainsKey(rowMap(), rowKey); } @Override - public boolean containsColumn(@CheckForNull Object columnKey) { + public boolean containsColumn(@Readonly AbstractTable this, @CheckForNull @Readonly Object columnKey) { return Maps.safeContainsKey(columnMap(), columnKey); } @Override - public Set rowKeySet() { + public @PolyMutable Set rowKeySet(@PolyMutable AbstractTable this) { return rowMap().keySet(); } @Override - public Set columnKeySet() { + public @PolyMutable Set columnKeySet(@PolyMutable AbstractTable this) { return columnMap().keySet(); } @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly AbstractTable this, @CheckForNull @UnknownSignedness @Readonly Object value) { for (Map row : rowMap().values()) { if (row.containsValue(value)) { return true; @@ -72,32 +82,32 @@ public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { } @Override - public boolean contains(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public boolean contains(@Readonly AbstractTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { Map row = Maps.safeGet(rowMap(), rowKey); return row != null && Maps.safeContainsKey(row, columnKey); } @Override @CheckForNull - public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V get(@Readonly AbstractTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { Map row = Maps.safeGet(rowMap(), rowKey); return (row == null) ? null : Maps.safeGet(row, columnKey); } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly AbstractTable this) { return size() == 0; } @Override - public void clear() { + public void clear(@Mutable AbstractTable this) { Iterators.clear(cellSet().iterator()); } @CanIgnoreReturnValue @Override @CheckForNull - public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V remove(@Mutable AbstractTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { Map row = Maps.safeGet(rowMap(), rowKey); return (row == null) ? null : Maps.safeRemove(row, columnKey); } @@ -105,38 +115,39 @@ public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { @CanIgnoreReturnValue @Override @CheckForNull - public V put( + public V put(@Mutable AbstractTable this, @ParametricNullness R rowKey, @ParametricNullness C columnKey, @ParametricNullness V value) { return row(rowKey).put(columnKey, value); } @Override - public void putAll(Table table) { + public void putAll(@Mutable AbstractTable this, Table table) { for (Table.Cell cell : table.cellSet()) { put(cell.getRowKey(), cell.getColumnKey(), cell.getValue()); } } - - @LazyInit @CheckForNull private transient Set> cellSet; + @CFComment("Change to @LazyFinal later") + @LazyInit @CheckForNull private transient @Assignable Set> cellSet; @Override - public Set> cellSet() { + public @PolyMutable Set> cellSet(@PolyMutable AbstractTable this) { Set> result = cellSet; return (result == null) ? cellSet = createCellSet() : result; } - Set> createCellSet() { - return new CellSet(); + @PolyMutable Set> createCellSet(@PolyMutable AbstractTable this) { + return new @PolyMutable CellSet(); } - abstract Iterator> cellIterator(); + abstract Iterator> cellIterator(@Readonly AbstractTable this); - abstract Spliterator> cellSpliterator(); + abstract Spliterator> cellSpliterator(@Readonly AbstractTable this); @WeakOuter + @ReceiverDependentMutable class CellSet extends AbstractSet> { @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly CellSet this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (o instanceof Cell) { Cell cell = (Cell) o; Map row = Maps.safeGet(rowMap(), cell.getRowKey()); @@ -148,7 +159,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object o) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable CellSet this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (o instanceof Cell) { Cell cell = (Cell) o; Map row = Maps.safeGet(rowMap(), cell.getRowKey()); @@ -160,7 +171,7 @@ public boolean remove(@CheckForNull @UnknownSignedness Object o) { } @Override - public void clear() { + public void clear(@Mutable CellSet this) { AbstractTable.this.clear(); } @@ -175,24 +186,25 @@ public Spliterator> spliterator() { } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly CellSet this) { return AbstractTable.this.size(); } } - @LazyInit @CheckForNull private transient Collection values; + @CFComment("Change to @LazyFinal later") + @LazyInit @CheckForNull private transient @Assignable Collection values; @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable AbstractTable this) { Collection result = values; return (result == null) ? values = createValues() : result; } - Collection createValues() { - return new Values(); + @PolyMutable Collection createValues(@PolyMutable AbstractTable this) { + return new @PolyMutable Values(); } - Iterator valuesIterator() { + Iterator valuesIterator(@Readonly AbstractTable this) { return new TransformedIterator, V>(cellSet().iterator()) { @Override @ParametricNullness @@ -202,51 +214,52 @@ V transform(Cell cell) { }; } - Spliterator valuesSpliterator() { + Spliterator valuesSpliterator(@Readonly AbstractTable this) { return CollectSpliterators.map(cellSpliterator(), Table.Cell::getValue); } @WeakOuter + @ReceiverDependentMutable class Values extends AbstractCollection { @Override - public Iterator iterator() { + public Iterator iterator(@Readonly Values this) { return valuesIterator(); } @Override - public Spliterator spliterator() { + public Spliterator spliterator(@Readonly Values this) { return valuesSpliterator(); } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly Values this, @CheckForNull @UnknownSignedness @Readonly Object o) { return containsValue(o); } @Override - public void clear() { + public void clear(@Mutable Values this) { AbstractTable.this.clear(); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly Values this) { return AbstractTable.this.size(); } } @Override - public boolean equals(@CheckForNull Object obj) { + public boolean equals(@Readonly AbstractTable this, @CheckForNull @Readonly Object obj) { return Tables.equalsImpl(this, obj); } @Override - public int hashCode(@UnknownSignedness AbstractTable this) { + public int hashCode(@UnknownSignedness @Readonly AbstractTable this) { return cellSet().hashCode(); } /** Returns the string representation {@code rowMap().toString()}. */ @Override - public String toString() { + public String toString(@Readonly AbstractTable this) { return rowMap().toString(); } } diff --git a/guava/src/com/google/common/collect/AllEqualOrdering.java b/guava/src/com/google/common/collect/AllEqualOrdering.java index f6ca6faff797..72c447f6d630 100644 --- a/guava/src/com/google/common/collect/AllEqualOrdering.java +++ b/guava/src/com/google/common/collect/AllEqualOrdering.java @@ -21,36 +21,39 @@ import java.util.List; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * An ordering that treats all references as equals, even nulls. * * @author Emily Soldal */ +@AnnotatedFor("pico") @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -final class AllEqualOrdering extends Ordering<@Nullable Object> implements Serializable { +final class AllEqualOrdering extends Ordering<@Nullable @Readonly Object> implements Serializable { static final AllEqualOrdering INSTANCE = new AllEqualOrdering(); @Override - public int compare(@CheckForNull Object left, @CheckForNull Object right) { + public int compare(@CheckForNull @Readonly Object left, @CheckForNull @Readonly Object right) { return 0; } @Override - public List sortedCopy(Iterable iterable) { + public List sortedCopy(Iterable iterable) { return Lists.newArrayList(iterable); } @Override @SuppressWarnings("nullness") // unsafe: see supertype - public ImmutableList immutableSortedCopy(Iterable iterable) { + public ImmutableList immutableSortedCopy(Iterable iterable) { return ImmutableList.copyOf(iterable); } @SuppressWarnings("unchecked") @Override - public Ordering reverse() { + public Ordering reverse() { return (Ordering) this; } diff --git a/guava/src/com/google/common/collect/ArrayListMultimap.java b/guava/src/com/google/common/collect/ArrayListMultimap.java index 524fb40e9280..94a52e96491c 100644 --- a/guava/src/com/google/common/collect/ArrayListMultimap.java +++ b/guava/src/com/google/common/collect/ArrayListMultimap.java @@ -30,6 +30,11 @@ import java.util.List; import java.util.Map; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -61,10 +66,11 @@ * @author Jared Levy * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public final class ArrayListMultimap +@ReceiverDependentMutable +public final class ArrayListMultimap extends ArrayListMultimapGwtSerializationDependencies { // Default from ArrayList private static final int DEFAULT_VALUES_PER_KEY = 3; @@ -77,8 +83,7 @@ public final class ArrayListMultimapThis method will soon be deprecated in favor of {@code * MultimapBuilder.hashKeys().arrayListValues().build()}. */ - public static - ArrayListMultimap create() { + public static ArrayListMultimap create() { return new ArrayListMultimap<>(); } @@ -94,8 +99,8 @@ ArrayListMultimap create() { * @throws IllegalArgumentException if {@code expectedKeys} or {@code expectedValuesPerKey} is * negative */ - public static - ArrayListMultimap create(int expectedKeys, int expectedValuesPerKey) { + public static + ArrayListMultimap create(int expectedKeys, int expectedValuesPerKey) { return new ArrayListMultimap<>(expectedKeys, expectedValuesPerKey); } @@ -107,9 +112,9 @@ ArrayListMultimap create(int expectedKeys, int expectedValuesPerKey) { * * @param multimap the multimap whose contents are copied to this multimap */ - public static - ArrayListMultimap create(Multimap multimap) { - return new ArrayListMultimap<>(multimap); + public static + @PolyMutable ArrayListMultimap create(@PolyMutable Multimap multimap) { + return new @PolyMutable ArrayListMultimap<>(multimap); } private ArrayListMultimap() { @@ -117,12 +122,12 @@ private ArrayListMultimap() { } private ArrayListMultimap(int expectedKeys, int expectedValuesPerKey) { - super(Platform.>newHashMapWithExpectedSize(expectedKeys)); + super(Platform.>newHashMapWithExpectedSize(expectedKeys)); checkNonnegative(expectedValuesPerKey, "expectedValuesPerKey"); this.expectedValuesPerKey = expectedValuesPerKey; } - private ArrayListMultimap(Multimap multimap) { + private ArrayListMultimap(@ReceiverDependentMutable Multimap multimap) { this( multimap.keySet().size(), (multimap instanceof ArrayListMultimap) @@ -135,8 +140,8 @@ private ArrayListMultimap(Multimap multimap) { * Creates a new, empty {@code ArrayList} to hold the collection of values for an arbitrary key. */ @Override - List createCollection() { - return new ArrayList(expectedValuesPerKey); + @PolyMutable List createCollection(@PolyMutable ArrayListMultimap this) { + return new @PolyMutable ArrayList(expectedValuesPerKey); } /** @@ -147,7 +152,7 @@ List createCollection() { * call, or switch to a {@code HashMap>}. */ @Deprecated - public void trimToSize() { + public void trimToSize(@Mutable ArrayListMultimap this) { for (Collection collection : backingMap().values()) { ArrayList arrayList = (ArrayList) collection; arrayList.trimToSize(); @@ -178,31 +183,31 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo private static final long serialVersionUID = 0; @Override -public boolean containsEntry(@Nullable Object arg0, @Nullable Object arg1) { return super.containsEntry(arg0, arg1); } +public boolean containsEntry(@Readonly ArrayListMultimap this, @Nullable @Readonly Object arg0, @Nullable @Readonly Object arg1) { return super.containsEntry(arg0, arg1); } @Override -public boolean containsKey(@Nullable @UnknownSignedness Object arg0) { return super.containsKey(arg0); } +public boolean containsKey(@Readonly ArrayListMultimap this, @Nullable @UnknownSignedness @Readonly Object arg0) { return super.containsKey(arg0); } @Override -public boolean containsValue(@Nullable @UnknownSignedness Object arg0) { return super.containsValue(arg0); } +public boolean containsValue(@Readonly ArrayListMultimap this, @Nullable @UnknownSignedness @Readonly Object arg0) { return super.containsValue(arg0); } @Override -public boolean equals(@Nullable Object arg0) { return super.equals(arg0); } +public boolean equals(@Readonly ArrayListMultimap this, @Nullable @Readonly Object arg0) { return super.equals(arg0); } @Pure @Override -public boolean isEmpty() { return super.isEmpty(); } +public boolean isEmpty(@Readonly ArrayListMultimap this) { return super.isEmpty(); } @Override -public List get(@Nullable K arg0) { return super.get(arg0); } +public @PolyMutable List get(@PolyMutable ArrayListMultimap this, @Nullable K arg0) { return super.get(arg0); } @Override -public boolean remove(@Nullable Object arg0, @Nullable Object arg1) { return super.remove(arg0, arg1); } +public boolean remove(@Mutable ArrayListMultimap this, @Nullable @Readonly Object arg0, @Nullable @Readonly Object arg1) { return super.remove(arg0, arg1); } @Override -public List removeAll(@Nullable Object arg0) { return super.removeAll(arg0); } +public @Readonly List removeAll(@Mutable ArrayListMultimap this, @Nullable @Readonly Object arg0) { return super.removeAll(arg0); } @Pure @Override -public int size() { return super.size(); } +public int size(@Readonly ArrayListMultimap this) { return super.size(); } } diff --git a/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java b/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java index 9a8cdfbdbd13..040a5bf494f5 100644 --- a/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java +++ b/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java @@ -19,6 +19,9 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A dummy superclass to support GWT serialization of the element types of an {@link @@ -29,10 +32,12 @@ * *

TODO(cpovirk): Consider applying this subclass approach to our other types. */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) -abstract class ArrayListMultimapGwtSerializationDependencies +@ReceiverDependentMutable +abstract class ArrayListMultimapGwtSerializationDependencies extends AbstractListMultimap { - ArrayListMultimapGwtSerializationDependencies(Map> map) { + ArrayListMultimapGwtSerializationDependencies(@ReceiverDependentMutable Map> map) { super(map); } // TODO(cpovirk): Maybe I should have just one shared superclass for AbstractMultimap itself? diff --git a/guava/src/com/google/common/collect/ArrayTable.java b/guava/src/com/google/common/collect/ArrayTable.java index 3c9411776d3d..bc3777c7aee8 100644 --- a/guava/src/com/google/common/collect/ArrayTable.java +++ b/guava/src/com/google/common/collect/ArrayTable.java @@ -41,6 +41,10 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -95,7 +99,8 @@ @Beta @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -public final class ArrayTable extends AbstractTable +@ReceiverDependentMutable +public final class ArrayTable extends AbstractTable implements Serializable { /** @@ -107,7 +112,7 @@ public final class ArrayTable extends AbstractTable * @throws IllegalArgumentException if {@code rowKeys} or {@code columnKeys} contains duplicates * or if exactly one of {@code rowKeys} or {@code columnKeys} is empty. */ - public static ArrayTable create( + public static ArrayTable create( Iterable rowKeys, Iterable columnKeys) { return new ArrayTable<>(rowKeys, columnKeys); } @@ -136,7 +141,7 @@ public static ArrayTable create( * * @throws NullPointerException if {@code table} has a null key */ - public static ArrayTable create(Table table) { + public static ArrayTable create(Table table) { return (table instanceof ArrayTable) ? new ArrayTable((ArrayTable) table) : new ArrayTable(table); @@ -191,7 +196,8 @@ private ArrayTable(ArrayTable table) { } } - private abstract static class ArrayMap + @ReceiverDependentMutable + private abstract static class ArrayMap extends IteratorBasedAbstractMap { private final ImmutableMap keyIndex; @@ -294,7 +300,7 @@ public V put(K key, @ParametricNullness V value) { @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@CheckForNull @UnknownSignedness @Readonly Object key) { throw new UnsupportedOperationException(); } @@ -769,6 +775,7 @@ public ImmutableSet rowKeySet() { } @WeakOuter + @ReceiverDependentMutable private class RowMap extends ArrayMap> { private RowMap() { super(rowKeyToIndex); @@ -811,7 +818,7 @@ String getKeyRole() { } @Override - Iterator<@Nullable V> valuesIterator() { + @ReceiverDependentMutable Iterator<@Nullable V> valuesIterator() { return new AbstractIndexedListIterator<@Nullable V>(size()) { @Override @CheckForNull diff --git a/guava/src/com/google/common/collect/BaseImmutableMultimap.java b/guava/src/com/google/common/collect/BaseImmutableMultimap.java index 2e69c2a92e39..bc782885a3dc 100644 --- a/guava/src/com/google/common/collect/BaseImmutableMultimap.java +++ b/guava/src/com/google/common/collect/BaseImmutableMultimap.java @@ -16,11 +16,15 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A dummy superclass of {@link ImmutableMultimap} that can be instanceof'd without ProGuard * retaining additional implementation details of {@link ImmutableMultimap}. */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class BaseImmutableMultimap extends AbstractMultimap {} +@Immutable +abstract class BaseImmutableMultimap extends AbstractMultimap {} diff --git a/guava/src/com/google/common/collect/BiMap.java b/guava/src/com/google/common/collect/BiMap.java index 9ec8abc4d8a3..0277ce2df380 100644 --- a/guava/src/com/google/common/collect/BiMap.java +++ b/guava/src/com/google/common/collect/BiMap.java @@ -22,7 +22,13 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * A bimap (or "bidirectional map") is a map that preserves the uniqueness of its values as well as @@ -36,9 +42,11 @@ * @since 2.0 */ @GwtCompatible -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @ElementTypesAreNonnullByDefault -public interface BiMap extends Map { +@CFComment("PICO: BiMap both key and value type are immutable") +@ReceiverDependentMutable +public interface BiMap extends Map { // Modification Operations /** @@ -51,7 +59,7 @@ public interface BiMap e @CanIgnoreReturnValue @Override @CheckForNull - V put(@ParametricNullness K key, @ParametricNullness V value); + V put(@Mutable BiMap this, @ParametricNullness K key, @ParametricNullness V value); /** * An alternate form of {@code put} that silently removes any existing entry with the value {@code @@ -73,7 +81,7 @@ public interface BiMap e */ @CanIgnoreReturnValue @CheckForNull - V forcePut(@ParametricNullness K key, @ParametricNullness V value); + V forcePut(@Mutable BiMap this, @ParametricNullness K key, @ParametricNullness V value); // Bulk Operations @@ -87,7 +95,7 @@ public interface BiMap e * map entries may have been added to the bimap before the exception was thrown. */ @Override - void putAll(Map map); + void putAll(@Mutable BiMap this, @Readonly Map map); // Views @@ -98,7 +106,7 @@ public interface BiMap e * java.util.Collection} specified in the {@link Map} interface. */ @Override - Set values(); + Set values(@PolyMutable BiMap this); /** * Returns the inverse view of this bimap, which maps each of this bimap's values to its @@ -110,5 +118,5 @@ public interface BiMap e * * @return the inverse view of this bimap */ - BiMap inverse(); + @PolyMutable BiMap inverse(@PolyMutable BiMap this); } diff --git a/guava/src/com/google/common/collect/CartesianList.java b/guava/src/com/google/common/collect/CartesianList.java index e14fb959fae2..87ad8d043895 100644 --- a/guava/src/com/google/common/collect/CartesianList.java +++ b/guava/src/com/google/common/collect/CartesianList.java @@ -24,22 +24,27 @@ import java.util.RandomAccess; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Implementation of {@link Lists#cartesianProduct(List)}. * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault +@Immutable final class CartesianList extends AbstractList> implements RandomAccess { private final transient ImmutableList> axes; private final transient int[] axesSizeProduct; - static List> create(List> lists) { - ImmutableList.Builder> axesBuilder = new ImmutableList.Builder<>(lists.size()); + static @Immutable List> create(@Immutable List> lists) { + ImmutableList.Builder<@Immutable List> axesBuilder = new ImmutableList.Builder<>(lists.size()); for (List list : lists) { List copy = ImmutableList.copyOf(list); if (copy.isEmpty()) { @@ -50,7 +55,8 @@ static List> create(List> lists) { return new CartesianList<>(axesBuilder.build()); } - CartesianList(ImmutableList> axes) { + @SuppressWarnings("pico:assignment.type.incompatible") // cast from @Unique @Mutable to @Immutable + CartesianList(ImmutableList<@Immutable List> axes) { this.axes = axes; int[] axesSizeProduct = new int[axes.size() + 1]; axesSizeProduct[axes.size()] = 1; @@ -70,11 +76,11 @@ private int getAxisIndexForProductIndex(int index, int axis) { } @Override - public int indexOf(@CheckForNull @UnknownSignedness Object o) { + public int indexOf(@CheckForNull @UnknownSignedness @Readonly Object o) { if (!(o instanceof List)) { return -1; } - List list = (List) o; + List list = (@Readonly List) o; if (list.size() != axes.size()) { return -1; } @@ -92,11 +98,11 @@ public int indexOf(@CheckForNull @UnknownSignedness Object o) { } @Override - public int lastIndexOf(@CheckForNull @UnknownSignedness Object o) { + public int lastIndexOf(@CheckForNull @UnknownSignedness @Readonly Object o) { if (!(o instanceof List)) { return -1; } - List list = (List) o; + List list = (@Readonly List) o; if (list.size() != axes.size()) { return -1; } @@ -116,7 +122,7 @@ public int lastIndexOf(@CheckForNull @UnknownSignedness Object o) { @Override public ImmutableList get(int index) { checkElementIndex(index, size()); - return new ImmutableList() { + return new @Immutable ImmutableList() { @Override public @NonNegative int size() { @@ -143,11 +149,11 @@ boolean isPartialView() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { if (!(object instanceof List)) { return false; } - List list = (List) object; + List list = (@Readonly List) object; if (list.size() != axes.size()) { return false; } diff --git a/guava/src/com/google/common/collect/ClassToInstanceMap.java b/guava/src/com/google/common/collect/ClassToInstanceMap.java index 870e3cb7f47f..6381893ad18f 100644 --- a/guava/src/com/google/common/collect/ClassToInstanceMap.java +++ b/guava/src/com/google/common/collect/ClassToInstanceMap.java @@ -22,6 +22,7 @@ import java.util.Map; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -62,6 +63,7 @@ // we might annotate this as... // ClassToInstanceMap extends Map, B> // ...and change its methods similarly ( or Class<@Nonnull T>). +@ReceiverDependentMutable public interface ClassToInstanceMap extends Map, B> { /** * Returns the value the specified class is mapped to, or {@code null} if no entry for this class diff --git a/guava/src/com/google/common/collect/CollectCollectors.java b/guava/src/com/google/common/collect/CollectCollectors.java index f582660c8ee1..0bea37146c85 100644 --- a/guava/src/com/google/common/collect/CollectCollectors.java +++ b/guava/src/com/google/common/collect/CollectCollectors.java @@ -37,20 +37,22 @@ import java.util.stream.Stream; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; /** Collectors utilities for {@code common.collect} internals. */ @GwtCompatible @ElementTypesAreNonnullByDefault final class CollectCollectors { - private static final Collector> TO_IMMUTABLE_LIST = + private static final Collector> TO_IMMUTABLE_LIST = Collector.of( ImmutableList::builder, ImmutableList.Builder::add, ImmutableList.Builder::combine, ImmutableList.Builder::build); - private static final Collector> TO_IMMUTABLE_SET = + private static final Collector> TO_IMMUTABLE_SET = Collector.of( ImmutableSet::builder, ImmutableSet.Builder::add, @@ -134,14 +136,14 @@ ImmutableSet toImmutableSet() { @GwtIncompatible @SuppressWarnings({"rawtypes", "unchecked"}) - static > + static > Collector, ?, ImmutableRangeSet> toImmutableRangeSet() { return (Collector) TO_IMMUTABLE_RANGE_SET; } // Multisets - static Collector> toImmutableMultiset( + static Collector> toImmutableMultiset( Function elementFunction, ToIntFunction countFunction) { checkNotNull(elementFunction); checkNotNull(countFunction); @@ -156,7 +158,7 @@ ImmutableSet toImmutableSet() { (Multiset multiset) -> ImmutableMultiset.copyFromEntries(multiset.entrySet())); } - static > + static > Collector toMultiset( Function elementFunction, ToIntFunction countFunction, @@ -175,7 +177,7 @@ ImmutableSet toImmutableSet() { // Maps - static Collector> toImmutableMap( + static Collector> toImmutableMap( Function keyFunction, Function valueFunction) { checkNotNull(keyFunction); @@ -187,7 +189,7 @@ ImmutableSet toImmutableSet() { ImmutableMap.Builder::build); } - public static + public static Collector> toImmutableMap( Function keyFunction, Function valueFunction, @@ -200,7 +202,7 @@ ImmutableSet toImmutableSet() { ImmutableMap::copyOf); } - static + static Collector> toImmutableSortedMap( Comparator comparator, Function keyFunction, @@ -220,7 +222,7 @@ ImmutableSet toImmutableSet() { Collector.Characteristics.UNORDERED); } - static + static Collector> toImmutableSortedMap( Comparator comparator, Function keyFunction, @@ -236,7 +238,7 @@ ImmutableSet toImmutableSet() { ImmutableSortedMap::copyOfSorted); } - static Collector> toImmutableBiMap( + static Collector> toImmutableBiMap( Function keyFunction, Function valueFunction) { checkNotNull(keyFunction); @@ -249,7 +251,7 @@ ImmutableSet toImmutableSet() { new Collector.Characteristics[0]); } - static , V> + static , V> Collector> toImmutableEnumMap( Function keyFunction, Function valueFunction) { @@ -277,7 +279,7 @@ ImmutableSet toImmutableSet() { Collector.Characteristics.UNORDERED); } - static , V> + static , V> Collector> toImmutableEnumMap( Function keyFunction, Function valueFunction, @@ -330,12 +332,12 @@ EnumMapAccumulator combine(EnumMapAccumulator other) { } ImmutableMap toImmutableMap() { - return (map == null) ? ImmutableMap.of() : ImmutableEnumMap.asImmutable(map); + return (map == null) ? ImmutableMap.of() : ImmutableEnumMap.asImmutable(map); } } @GwtIncompatible - static , V> + static , V> Collector> toImmutableRangeMap( Function> keyFunction, Function valueFunction) { @@ -350,7 +352,7 @@ ImmutableMap toImmutableMap() { // Multimaps - static + static Collector> toImmutableListMultimap( Function keyFunction, Function valueFunction) { @@ -363,7 +365,7 @@ ImmutableMap toImmutableMap() { ImmutableListMultimap.Builder::build); } - static + static Collector> flatteningToImmutableListMultimap( Function keyFunction, Function> valuesFunction) { @@ -377,7 +379,7 @@ ImmutableMap toImmutableMap() { ImmutableListMultimap::copyOf); } - static + static Collector> toImmutableSetMultimap( Function keyFunction, Function valueFunction) { @@ -390,7 +392,7 @@ ImmutableMap toImmutableMap() { ImmutableSetMultimap.Builder::build); } - static + static Collector> flatteningToImmutableSetMultimap( Function keyFunction, Function> valuesFunction) { @@ -405,9 +407,9 @@ ImmutableMap toImmutableMap() { } static < - T extends @Nullable Object, - K extends @Nullable Object, - V extends @Nullable Object, + T extends @Nullable @Readonly Object, + K extends @Nullable @Immutable Object, + V extends @Nullable @Readonly Object, M extends Multimap> Collector toMultimap( Function keyFunction, @@ -426,9 +428,9 @@ ImmutableMap toImmutableMap() { } static < - T extends @Nullable Object, - K extends @Nullable Object, - V extends @Nullable Object, + T extends @Nullable @Readonly Object, + K extends @Nullable @Immutable Object, + V extends @Nullable @Readonly Object, M extends Multimap> Collector flatteningToMultimap( Function keyFunction, diff --git a/guava/src/com/google/common/collect/CollectPreconditions.java b/guava/src/com/google/common/collect/CollectPreconditions.java index 38ebfe94ab8e..ca244693ac2f 100644 --- a/guava/src/com/google/common/collect/CollectPreconditions.java +++ b/guava/src/com/google/common/collect/CollectPreconditions.java @@ -22,14 +22,17 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.index.qual.Positive; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** Precondition checks useful in collection implementations. */ @GwtCompatible @ElementTypesAreNonnullByDefault +@AnnotatedFor("pico") final class CollectPreconditions { - static void checkEntryNotNull(@UnknownSignedness Object key, @UnknownSignedness Object value) { + static void checkEntryNotNull(@UnknownSignedness @Readonly Object key, @UnknownSignedness @Readonly Object value) { if (key == null) { throw new NullPointerException("null key in entry: null=" + value); } else if (value == null) { diff --git a/guava/src/com/google/common/collect/CollectSpliterators.java b/guava/src/com/google/common/collect/CollectSpliterators.java index 7d0e82f203a8..2da5729ad496 100644 --- a/guava/src/com/google/common/collect/CollectSpliterators.java +++ b/guava/src/com/google/common/collect/CollectSpliterators.java @@ -35,6 +35,8 @@ import java.util.stream.IntStream; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Readonly; /** Spliterator utilities for {@code common.collect} internals. */ @GwtCompatible @@ -42,12 +44,12 @@ final class CollectSpliterators { private CollectSpliterators() {} - static Spliterator indexed( + static Spliterator indexed( int size, int extraCharacteristics, IntFunction function) { return indexed(size, extraCharacteristics, function, null); } - static Spliterator indexed( + static Spliterator indexed( int size, int extraCharacteristics, IntFunction function, @@ -109,7 +111,7 @@ public Comparator getComparator() { * Returns a {@code Spliterator} over the elements of {@code fromSpliterator} mapped by {@code * function}. */ - static + static Spliterator map( Spliterator fromSpliterator, Function function) { @@ -149,7 +151,7 @@ public int characteristics() { } /** Returns a {@code Spliterator} filtered by the specified predicate. */ - static Spliterator filter( + static Spliterator filter( Spliterator fromSpliterator, Predicate predicate) { checkNotNull(fromSpliterator); checkNotNull(predicate); @@ -212,7 +214,7 @@ public int characteristics() { * Returns a {@code Spliterator} that iterates over the elements of the spliterators generated by * applying {@code function} to the elements of {@code fromSpliterator}. */ - static + static Spliterator flatMap( Spliterator fromSpliterator, Function> function, @@ -304,13 +306,13 @@ Spliterator flatMap( * @param the type of the output spliterators */ abstract static class FlatMapSpliterator< - InElementT extends @Nullable Object, - OutElementT extends @Nullable Object, + InElementT extends @Nullable @Readonly Object, + OutElementT extends @Nullable @Readonly Object, OutSpliteratorT extends Spliterator> implements Spliterator { /** Factory for constructing {@link FlatMapSpliterator} instances. */ @FunctionalInterface - interface Factory> { + interface Factory> { OutSpliteratorT newFlatMapSpliterator( @CheckForNull OutSpliteratorT prefix, Spliterator fromSplit, @@ -319,12 +321,12 @@ OutSpliteratorT newFlatMapSpliterator( long estSplitSize); } - @Weak @CheckForNull OutSpliteratorT prefix; + @Weak @CheckForNull @Assignable OutSpliteratorT prefix; final Spliterator from; final Function function; final Factory factory; - int characteristics; - long estimatedSize; + @Assignable int characteristics; + @Assignable long estimatedSize; FlatMapSpliterator( @CheckForNull OutSpliteratorT prefix, @@ -433,7 +435,7 @@ public final int characteristics() { * @param the element type of the output spliterators */ static final class FlatMapSpliteratorOfObject< - InElementT extends @Nullable Object, OutElementT extends @Nullable Object> + InElementT extends @Nullable @Readonly Object, OutElementT extends @Nullable @Readonly Object> extends FlatMapSpliterator> { FlatMapSpliteratorOfObject( @CheckForNull Spliterator prefix, @@ -455,8 +457,8 @@ static final class FlatMapSpliteratorOfObject< * @param the primitive spliterator type associated with {@code OutElementT} */ abstract static class FlatMapSpliteratorOfPrimitive< - InElementT extends @Nullable Object, - OutElementT extends @Nullable Object, + InElementT extends @Nullable @Readonly Object, + OutElementT extends @Nullable @Readonly Object, OutConsumerT, OutSpliteratorT extends Spliterator.OfPrimitive> @@ -508,7 +510,7 @@ public final void forEachRemaining(OutConsumerT action) { } /** Implementation of {@link #flatMapToInt}. */ - static final class FlatMapSpliteratorOfInt + static final class FlatMapSpliteratorOfInt extends FlatMapSpliteratorOfPrimitive implements Spliterator.OfInt { FlatMapSpliteratorOfInt( diff --git a/guava/src/com/google/common/collect/Collections2.java b/guava/src/com/google/common/collect/Collections2.java index 868b9f69ea5e..b485fee2d7f2 100644 --- a/guava/src/com/google/common/collect/Collections2.java +++ b/guava/src/com/google/common/collect/Collections2.java @@ -42,6 +42,11 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.Signed; import org.checkerframework.checker.signedness.qual.UnknownSignedness; @@ -61,7 +66,7 @@ * @author Jared Levy * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault public final class Collections2 { @@ -94,22 +99,22 @@ private Collections2() {} */ // TODO(kevinb): how can we omit that Iterables link when building gwt // javadoc? - public static Collection filter( - Collection unfiltered, Predicate predicate) { + public static @PolyMutable Collection filter( + @PolyMutable Collection unfiltered, Predicate predicate) { if (unfiltered instanceof FilteredCollection) { // Support clear(), removeAll(), and retainAll() when filtering a filtered // collection. return ((FilteredCollection) unfiltered).createCombined(predicate); } - return new FilteredCollection(checkNotNull(unfiltered), checkNotNull(predicate)); + return new @PolyMutable FilteredCollection(checkNotNull(unfiltered), checkNotNull(predicate)); } /** * Delegates to {@link Collection#contains}. Returns {@code false} if the {@code contains} method * throws a {@code ClassCastException} or {@code NullPointerException}. */ - static boolean safeContains(Collection collection, @CheckForNull @UnknownSignedness Object object) { + static boolean safeContains(@Readonly Collection collection, @CheckForNull @UnknownSignedness @Readonly Object object) { checkNotNull(collection); try { return collection.contains(object); @@ -122,7 +127,7 @@ static boolean safeContains(Collection collection, @CheckForNull @UnknownSign * Delegates to {@link Collection#remove}. Returns {@code false} if the {@code remove} method * throws a {@code ClassCastException} or {@code NullPointerException}. */ - static boolean safeRemove(Collection collection, @CheckForNull Object object) { + static boolean safeRemove(Collection collection, @CheckForNull @Readonly Object object) { checkNotNull(collection); try { return collection.remove(object); @@ -131,11 +136,12 @@ static boolean safeRemove(Collection collection, @CheckForNull Object object) } } - static class FilteredCollection extends AbstractCollection { + @ReceiverDependentMutable + static class FilteredCollection extends AbstractCollection { final Collection unfiltered; - final Predicate predicate; + final @Mutable Predicate predicate; - FilteredCollection(Collection unfiltered, Predicate predicate) { + FilteredCollection(@ReceiverDependentMutable Collection unfiltered, Predicate predicate) { this.unfiltered = unfiltered; this.predicate = predicate; } @@ -146,13 +152,13 @@ FilteredCollection createCombined(Predicate newPredicate) { } @Override - public boolean add(@ParametricNullness E element) { + public boolean add(@Mutable FilteredCollection this, @ParametricNullness E element) { checkArgument(predicate.apply(element)); return unfiltered.add(element); } @Override - public boolean addAll(Collection collection) { + public boolean addAll(@Mutable FilteredCollection this, Collection collection) { for (E element : collection) { checkArgument(predicate.apply(element)); } @@ -160,13 +166,13 @@ public boolean addAll(Collection collection) { } @Override - public void clear() { + public void clear(@Mutable FilteredCollection this) { Iterables.removeIf(unfiltered, predicate); } @Pure @Override - public boolean contains(@CheckForNull @UnknownSignedness Object element) { + public boolean contains(@Readonly FilteredCollection this, @CheckForNull @UnknownSignedness @Readonly Object element) { if (safeContains(unfiltered, element)) { @SuppressWarnings("unchecked") // element is in unfiltered, so it must be an E E e = (E) element; @@ -177,23 +183,23 @@ public boolean contains(@CheckForNull @UnknownSignedness Object element) { @Pure @Override - public boolean containsAll(Collection collection) { + public boolean containsAll(@Readonly FilteredCollection this, @Readonly Collection collection) { return containsAllImpl(this, collection); } @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly FilteredCollection this) { return !Iterables.any(unfiltered, predicate); } @Override - public Iterator iterator() { + public @Readonly Iterator iterator(@Readonly FilteredCollection this) { return Iterators.filter(unfiltered.iterator(), predicate); } @Override - public Spliterator spliterator() { + public Spliterator spliterator(@Readonly FilteredCollection this) { return CollectSpliterators.filter(unfiltered.spliterator(), predicate); } @@ -209,29 +215,29 @@ public void forEach(Consumer action) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object element) { + public boolean remove(@Mutable FilteredCollection this, @CheckForNull @UnknownSignedness @Readonly Object element) { return contains(element) && unfiltered.remove(element); } @Override - public boolean removeAll(final Collection collection) { + public boolean removeAll(@Mutable FilteredCollection this, final @Readonly Collection collection) { return removeIf(collection::contains); } @Override - public boolean retainAll(final Collection collection) { + public boolean retainAll(@Mutable FilteredCollection this, final @Readonly Collection collection) { return removeIf(element -> !collection.contains(element)); } @Override - public boolean removeIf(java.util.function.Predicate filter) { + public boolean removeIf(@Mutable FilteredCollection this, java.util.function.Predicate filter) { checkNotNull(filter); return unfiltered.removeIf(element -> predicate.apply(element) && filter.test(element)); } @Pure @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly FilteredCollection this) { int size = 0; for (E e : unfiltered) { if (predicate.apply(e)) { @@ -242,20 +248,20 @@ public boolean removeIf(java.util.function.Predicate filter) { } @Override - public @PolyNull @PolySigned Object[] toArray(FilteredCollection<@PolyNull @PolySigned E> this) { + public @PolyNull @PolySigned @PolyMutable Object[] toArray(FilteredCollection<@PolyNull @PolySigned @PolyMutable E> this) { // creating an ArrayList so filtering happens once return Lists.newArrayList(iterator()).toArray(); } @Override @SuppressWarnings("nullness:return") - public T[] toArray(@PolyNull T[] array) { + public T[] toArray(@PolyNull T[] array) { return Lists.newArrayList(iterator()).toArray(array); } @Pure @Override - public String toString() { return super.toString(); } + public String toString(@Readonly FilteredCollection this) { return super.toString(); } } /** @@ -277,40 +283,41 @@ public boolean removeIf(java.util.function.Predicate filter) { * *

{@code Stream} equivalent: {@link java.util.stream.Stream#map Stream.map}. */ - public static Collection transform( + public static Collection transform( Collection fromCollection, Function function) { return new TransformedCollection<>(fromCollection, function); } - static class TransformedCollection + @ReceiverDependentMutable + static class TransformedCollection extends AbstractCollection { final Collection fromCollection; - final Function function; + final @Mutable Function function; - TransformedCollection(Collection fromCollection, Function function) { + TransformedCollection(@ReceiverDependentMutable Collection fromCollection, Function function) { this.fromCollection = checkNotNull(fromCollection); this.function = checkNotNull(function); } @Override - public void clear() { + public void clear(@Mutable TransformedCollection this) { fromCollection.clear(); } @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly TransformedCollection this) { return fromCollection.isEmpty(); } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly TransformedCollection this) { return Iterators.transform(fromCollection.iterator(), function); } @Pure @Override - public Spliterator spliterator() { + public Spliterator spliterator(@Readonly TransformedCollection this) { return CollectSpliterators.map(fromCollection.spliterator(), function); } @@ -321,13 +328,13 @@ public void forEach(Consumer action) { } @Override - public boolean removeIf(java.util.function.Predicate filter) { + public boolean removeIf(@Mutable TransformedCollection this, java.util.function.Predicate filter) { checkNotNull(filter); return fromCollection.removeIf(element -> filter.test(function.apply(element))); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly TransformedCollection this) { return fromCollection.size(); } } @@ -343,7 +350,7 @@ public boolean removeIf(java.util.function.Predicate filter) { * @param self a collection which might contain all elements in {@code c} * @param c a collection whose elements might be contained by {@code self} */ - static boolean containsAllImpl(Collection self, Collection c) { + static boolean containsAllImpl(@Readonly Collection self, @Readonly Collection c) { for (Object o : c) { if (!self.contains(o)) { return false; @@ -353,7 +360,7 @@ static boolean containsAllImpl(Collection self, Collection c) { } /** An implementation of {@link Collection#toString()}. */ - static String toStringImpl(final Collection collection) { + static String toStringImpl(final @Readonly Collection collection) { StringBuilder sb = newStringBuilderForCollection(collection.size()).append('['); boolean first = true; for (Object o : collection) { @@ -456,9 +463,10 @@ public static Collection> orderedPermutations( return new OrderedPermutationCollection(elements, comparator); } + @Immutable private static final class OrderedPermutationCollection extends AbstractCollection> { final ImmutableList inputList; - final Comparator comparator; + final @Mutable Comparator comparator; final int size; OrderedPermutationCollection(Iterable input, Comparator comparator) { @@ -513,7 +521,7 @@ public Iterator> iterator() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object obj) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object obj) { if (obj instanceof List) { List list = (List) obj; return isPermutation(inputList, list); @@ -527,11 +535,12 @@ public String toString() { } } + @ReceiverDependentMutable private static final class OrderedPermutationIterator extends AbstractIterator> { @CheckForNull List nextPermutation; - final Comparator comparator; + final @Mutable Comparator comparator; - OrderedPermutationIterator(List list, Comparator comparator) { + OrderedPermutationIterator(@ReceiverDependentMutable List list, Comparator comparator) { this.nextPermutation = Lists.newArrayList(list); this.comparator = comparator; } @@ -613,10 +622,11 @@ int findNextL(int j) { * @since 12.0 */ @Beta - public static Collection> permutations(Collection elements) { + public static Collection> permutations(@Readonly Collection elements) { return new PermutationCollection(ImmutableList.copyOf(elements)); } + @Immutable private static final class PermutationCollection extends AbstractCollection> { final ImmutableList inputList; @@ -640,7 +650,7 @@ public Iterator> iterator() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object obj) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object obj) { if (obj instanceof List) { List list = (List) obj; return isPermutation(inputList, list); @@ -654,13 +664,14 @@ public String toString() { } } + @ReceiverDependentMutable private static class PermutationIterator extends AbstractIterator> { final List list; final int[] c; final int[] o; int j; - PermutationIterator(List list) { + PermutationIterator(@ReceiverDependentMutable List list) { this.list = new ArrayList(list); int n = list.size(); c = new int[n]; @@ -719,7 +730,7 @@ void switchDirection() { } /** Returns {@code true} if the second list is a permutation of the first. */ - private static boolean isPermutation(List first, List second) { + private static boolean isPermutation(@Readonly List first, @Readonly List second) { if (first.size() != second.size()) { return false; } diff --git a/guava/src/com/google/common/collect/CompactHashMap.java b/guava/src/com/google/common/collect/CompactHashMap.java index 9c15a2aecd33..e800ac73bb83 100644 --- a/guava/src/com/google/common/collect/CompactHashMap.java +++ b/guava/src/com/google/common/collect/CompactHashMap.java @@ -55,6 +55,11 @@ import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; @@ -86,7 +91,8 @@ */ @GwtIncompatible // not worth using in GWT for now @ElementTypesAreNonnullByDefault -class CompactHashMap +@ReceiverDependentMutable +class CompactHashMap extends AbstractMap implements Serializable { /* * TODO: Make this a drop-in replacement for j.u. versions, actually drop them in, and test the @@ -97,8 +103,8 @@ class CompactHashMap */ /** Creates an empty {@code CompactHashMap} instance. */ - public static - CompactHashMap create() { + public static + CompactHashMap create() { return new CompactHashMap<>(); } @@ -111,8 +117,8 @@ CompactHashMap create() { * elements without resizing * @throws IllegalArgumentException if {@code expectedSize} is negative */ - public static - CompactHashMap createWithExpectedSize(int expectedSize) { + public static + CompactHashMap createWithExpectedSize(int expectedSize) { return new CompactHashMap<>(expectedSize); } @@ -234,10 +240,10 @@ CompactHashMap createWithExpectedSize(int expectedSize) { * its bottom {@value CompactHashing#HASH_TABLE_BITS_MAX_BITS} bits, with a modification count in * the remaining bits that is used to detect concurrent modification during iteration. */ - private transient int metadata; + private transient @Assignable int metadata; /** The number of elements contained in the set. */ - private transient int size; + private transient @Assignable int size; /** Constructs a new empty instance of {@code CompactHashMap}. */ CompactHashMap() { @@ -340,7 +346,7 @@ void accessEntry(int index) { @CanIgnoreReturnValue @Override @CheckForNull - public V put(@ParametricNullness K key, @ParametricNullness V value) { + public V put(@Mutable CompactHashMap this, @ParametricNullness K key, @ParametricNullness V value) { if (needsAllocArrays()) { allocArrays(); } @@ -532,7 +538,7 @@ public V get(@CheckForNull @UnknownSignedness Object key) { @SuppressWarnings("unchecked") // known to be a V @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@Mutable CompactHashMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { Map delegate = delegateOrNull(); if (delegate != null) { return delegate.remove(key); @@ -571,7 +577,7 @@ public V remove(@CheckForNull @UnknownSignedness Object key) { /** * Moves the last entry in the entry array into {@code dstIndex}, and nulls out its old position. */ - void moveLastEntry(int dstIndex, int mask) { + void moveLastEntry(@Mutable CompactHashMap this, int dstIndex, int mask) { Object table = requireTable(); int[] entries = requireEntries(); @Nullable Object[] keys = requireKeys(); @@ -997,7 +1003,7 @@ Collection createValues() { } @WeakOuter - class ValuesView extends Maps.Values { + @ReceiverDependentMutable class ValuesView extends Maps.Values { ValuesView() { super(CompactHashMap.this); } @@ -1044,7 +1050,7 @@ public Spliterator spliterator() { @Override @SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations - public T[] toArray(@PolyNull T[] a) { + public T[] toArray(@PolyNull T[] a) { if (needsAllocArrays()) { if (a.length > 0) { @Nullable Object[] unsoundlyCovariantArray = a; @@ -1167,11 +1173,11 @@ private int[] requireEntries() { return requireNonNull(entries); } - private @Nullable Object[] requireKeys() { + private @Nullable Object @ReceiverDependentMutable [] requireKeys() { return requireNonNull(keys); } - private @Nullable Object[] requireValues() { + private @Nullable Object @ReceiverDependentMutable [] requireValues() { return requireNonNull(values); } @@ -1197,11 +1203,11 @@ private int entry(int i) { return requireEntries()[i]; } - private void setKey(int i, K key) { + private void setKey(@Mutable CompactHashMap this, int i, K key) { requireKeys()[i] = key; } - private void setValue(int i, V value) { + private void setValue(@Mutable CompactHashMap this, int i, V value) { requireValues()[i] = value; } diff --git a/guava/src/com/google/common/collect/CompactHashSet.java b/guava/src/com/google/common/collect/CompactHashSet.java index 7b10c5a4e8d6..69a80c681b7a 100644 --- a/guava/src/com/google/common/collect/CompactHashSet.java +++ b/guava/src/com/google/common/collect/CompactHashSet.java @@ -49,6 +49,7 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; @@ -81,11 +82,12 @@ */ @GwtIncompatible // not worth using in GWT for now @ElementTypesAreNonnullByDefault -class CompactHashSet extends AbstractSet implements Serializable { +@ReceiverDependentMutable +class CompactHashSet extends AbstractSet implements Serializable { // TODO(user): cache all field accesses in local vars /** Creates an empty {@code CompactHashSet} instance. */ - public static CompactHashSet create() { + public static CompactHashSet create() { return new CompactHashSet<>(); } @@ -96,7 +98,7 @@ class CompactHashSet extends AbstractSet implemen * @param collection the elements that the set should contain * @return a new {@code CompactHashSet} containing those elements (minus duplicates) */ - public static CompactHashSet create( + public static CompactHashSet create( Collection collection) { CompactHashSet set = createWithExpectedSize(collection.size()); set.addAll(collection); @@ -454,7 +456,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object object) { @CanIgnoreReturnValue @Override - public boolean remove(@CheckForNull @UnknownSignedness Object object) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object object) { if (needsAllocArrays()) { return false; } diff --git a/guava/src/com/google/common/collect/CompactLinkedHashMap.java b/guava/src/com/google/common/collect/CompactLinkedHashMap.java index cd7edf5b33d6..ac3c90967e0e 100644 --- a/guava/src/com/google/common/collect/CompactLinkedHashMap.java +++ b/guava/src/com/google/common/collect/CompactLinkedHashMap.java @@ -32,6 +32,8 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.framework.qual.CFComment; @@ -58,12 +60,13 @@ */ @GwtIncompatible // not worth using in GWT for now @ElementTypesAreNonnullByDefault -class CompactLinkedHashMap +@ReceiverDependentMutable +class CompactLinkedHashMap extends CompactHashMap { // TODO(lowasser): implement removeEldestEntry so this can be used as a drop-in replacement /** Creates an empty {@code CompactLinkedHashMap} instance. */ - public static + public static CompactLinkedHashMap create() { return new CompactLinkedHashMap<>(); } @@ -77,7 +80,7 @@ CompactLinkedHashMap create() { * expectedSize} elements without resizing * @throws IllegalArgumentException if {@code expectedSize} is negative */ - public static + public static CompactLinkedHashMap createWithExpectedSize(int expectedSize) { return new CompactLinkedHashMap<>(expectedSize); } diff --git a/guava/src/com/google/common/collect/CompactLinkedHashSet.java b/guava/src/com/google/common/collect/CompactLinkedHashSet.java index d3d7b7cb5174..00692aadb440 100644 --- a/guava/src/com/google/common/collect/CompactLinkedHashSet.java +++ b/guava/src/com/google/common/collect/CompactLinkedHashSet.java @@ -29,6 +29,7 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; @@ -55,6 +56,7 @@ */ @GwtIncompatible // not worth using in GWT for now @ElementTypesAreNonnullByDefault +@ReceiverDependentMutable class CompactLinkedHashSet extends CompactHashSet { /** Creates an empty {@code CompactLinkedHashSet} instance. */ diff --git a/guava/src/com/google/common/collect/ComparatorOrdering.java b/guava/src/com/google/common/collect/ComparatorOrdering.java index d0df4a70bca9..cb43020582b2 100644 --- a/guava/src/com/google/common/collect/ComparatorOrdering.java +++ b/guava/src/com/google/common/collect/ComparatorOrdering.java @@ -23,15 +23,16 @@ import java.util.Comparator; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; /** An ordering for a pre-existing comparator. */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -final class ComparatorOrdering extends Ordering +final class ComparatorOrdering extends Ordering implements Serializable { final Comparator comparator; @@ -47,7 +48,7 @@ public int compare(@ParametricNullness T a, @ParametricNullness T b) { @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@CheckForNull @Readonly Object object) { if (object == this) { return true; } diff --git a/guava/src/com/google/common/collect/CompoundOrdering.java b/guava/src/com/google/common/collect/CompoundOrdering.java index 63690d37219c..5ff7a17917ff 100644 --- a/guava/src/com/google/common/collect/CompoundOrdering.java +++ b/guava/src/com/google/common/collect/CompoundOrdering.java @@ -22,15 +22,16 @@ import java.util.Comparator; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; /** An ordering that tries several comparators in order. */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -final class CompoundOrdering extends Ordering +final class CompoundOrdering extends Ordering implements Serializable { final Comparator[] comparators; @@ -56,7 +57,7 @@ public int compare(@ParametricNullness T left, @ParametricNullness T right) { @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@CheckForNull @Readonly Object object) { if (object == this) { return true; } diff --git a/guava/src/com/google/common/collect/ConcurrentHashMultiset.java b/guava/src/com/google/common/collect/ConcurrentHashMultiset.java index 2a9a016bdef2..a2065c5fee01 100644 --- a/guava/src/com/google/common/collect/ConcurrentHashMultiset.java +++ b/guava/src/com/google/common/collect/ConcurrentHashMultiset.java @@ -45,6 +45,11 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; @@ -66,7 +71,8 @@ @AnnotatedFor({"nullness"}) @GwtIncompatible @ElementTypesAreNonnullByDefault -public final class ConcurrentHashMultiset extends AbstractMultiset implements Serializable { +@ReceiverDependentMutable +public final class ConcurrentHashMultiset extends AbstractMultiset implements Serializable { /* * The ConcurrentHashMultiset's atomic operations are implemented primarily in terms of @@ -92,7 +98,7 @@ private static class FieldSettersHolder { * Creates a new, empty {@code ConcurrentHashMultiset} using the default initial capacity, load * factor, and concurrency settings. */ - public static ConcurrentHashMultiset create() { + public static ConcurrentHashMultiset create() { // TODO(schmoe): provide a way to use this class with other (possibly arbitrary) // ConcurrentMap implementors. One possibility is to extract most of this class into // an AbstractConcurrentMapMultiset. @@ -107,7 +113,7 @@ public static ConcurrentHashMultiset create() { * * @param elements the elements that the multiset should contain */ - public static ConcurrentHashMultiset create(Iterable elements) { + public static ConcurrentHashMultiset create(Iterable elements) { ConcurrentHashMultiset multiset = ConcurrentHashMultiset.create(); Iterables.addAll(multiset, elements); return multiset; @@ -128,12 +134,12 @@ public static ConcurrentHashMultiset create(Iterable element * @since 20.0 */ @Beta - public static ConcurrentHashMultiset create(ConcurrentMap countMap) { + public static ConcurrentHashMultiset create(ConcurrentMap countMap) { return new ConcurrentHashMultiset<>(countMap); } @VisibleForTesting - ConcurrentHashMultiset(ConcurrentMap countMap) { + ConcurrentHashMultiset(@ReceiverDependentMutable ConcurrentMap countMap) { checkArgument(countMap.isEmpty(), "the backing map (%s) must be empty", countMap); this.countMap = countMap; } @@ -147,7 +153,7 @@ public static ConcurrentHashMultiset create(ConcurrentMap this, @CheckForNull @UnknownSignedness @Readonly Object element) { AtomicInteger existingCounter = Maps.safeGet(countMap, element); return (existingCounter == null) ? 0 : existingCounter.get(); } @@ -160,7 +166,7 @@ public static ConcurrentHashMultiset create(ConcurrentMap this) { long sum = 0L; for (AtomicInteger value : countMap.values()) { sum += value.get(); @@ -174,13 +180,13 @@ public static ConcurrentHashMultiset create(ConcurrentMap this) { + public @PolyNull @PolySigned @PolyMutable Object @ReceiverDependentMutable [] toArray(@ReceiverDependentMutable ConcurrentHashMultiset<@PolyNull @PolySigned @PolyMutable E> this) { return snapshot().toArray(); } @Override @SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations - public T[] toArray(T[] array) { + public T[] toArray(T[] array) { return snapshot().toArray(array); } @@ -212,7 +218,7 @@ private List snapshot() { */ @CanIgnoreReturnValue @Override - public int add(E element, int occurrences) { + public int add(@Mutable ConcurrentHashMultiset this, E element, int occurrences) { checkNotNull(element); if (occurrences == 0) { return count(element); @@ -279,7 +285,7 @@ public int add(E element, int occurrences) { */ @CanIgnoreReturnValue @Override - public int remove(@CheckForNull Object element, int occurrences) { + public int remove(@Mutable ConcurrentHashMultiset this, @CheckForNull @Readonly Object element, int occurrences) { if (occurrences == 0) { return count(element); } @@ -320,7 +326,7 @@ public int remove(@CheckForNull Object element, int occurrences) { * @throws IllegalArgumentException if {@code occurrences} is negative */ @CanIgnoreReturnValue - public boolean removeExactly(@CheckForNull Object element, int occurrences) { + public boolean removeExactly(@Mutable ConcurrentHashMultiset this, @CheckForNull @Readonly Object element, int occurrences) { if (occurrences == 0) { return true; } @@ -356,7 +362,7 @@ public boolean removeExactly(@CheckForNull Object element, int occurrences) { */ @CanIgnoreReturnValue @Override - public int setCount(E element, int count) { + public int setCount(@Mutable ConcurrentHashMultiset this, E element, int count) { checkNotNull(element); checkNonnegative(count, "count"); while (true) { @@ -412,7 +418,7 @@ public int setCount(E element, int count) { */ @CanIgnoreReturnValue @Override - public boolean setCount(E element, int expectedOldCount, int newCount) { + public boolean setCount(@Mutable ConcurrentHashMultiset this, @Immutable E element, int expectedOldCount, int newCount) { checkNotNull(element); checkNonnegative(expectedOldCount, "oldCount"); checkNonnegative(newCount, "newCount"); @@ -501,13 +507,13 @@ public Set> createEntrySet() { } @Override - int distinctElements() { + int distinctElements(@Readonly ConcurrentHashMultiset this) { return countMap.size(); } @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly ConcurrentHashMultiset this) { return countMap.isEmpty(); } @@ -560,16 +566,17 @@ public void remove() { } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly ConcurrentHashMultiset this) { return Multisets.iteratorImpl(this); } @Override - public void clear() { + public void clear(@Mutable ConcurrentHashMultiset this) { countMap.clear(); } @WeakOuter + @ReceiverDependentMutable private class EntrySet extends AbstractMultiset.EntrySet { @Override ConcurrentHashMultiset multiset() { @@ -589,7 +596,7 @@ ConcurrentHashMultiset multiset() { @Override @SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations - public T[] toArray(T[] array) { + public T[] toArray(T[] array) { return snapshot().toArray(array); } @@ -602,19 +609,19 @@ private List> snapshot() { @Pure @Override - public @NonNegative int size() { return super.size(); } + public @NonNegative int size(@Readonly EntrySet this) { return super.size(); } @Pure @Override - public boolean isEmpty() { return super.isEmpty(); } + public boolean isEmpty(@Readonly EntrySet this) { return super.isEmpty(); } @Pure @Override - public boolean contains(@Nullable @UnknownSignedness Object arg0) { return super.contains(arg0); } + public boolean contains(@Readonly EntrySet this, @Nullable @UnknownSignedness @Readonly Object arg0) { return super.contains(arg0); } @Pure @Override - public boolean remove(@Nullable @UnknownSignedness Object arg0) { return super.remove(arg0); } + public boolean remove(@Mutable EntrySet this, @Nullable @UnknownSignedness @Readonly Object arg0) { return super.remove(arg0); } } /** @serialData the ConcurrentMap of elements and their counts. */ @@ -634,9 +641,9 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo private static final long serialVersionUID = 1; @Override -public boolean contains(@Nullable @UnknownSignedness Object arg0) { return super.contains(arg0); } +public boolean contains(@Readonly ConcurrentHashMultiset this, @Nullable @UnknownSignedness @Readonly Object arg0) { return super.contains(arg0); } @Pure @Override -public boolean containsAll(Collection arg0) { return super.containsAll(arg0); } +public boolean containsAll(@Readonly ConcurrentHashMultiset this, @Readonly Collection arg0) { return super.containsAll(arg0); } } diff --git a/guava/src/com/google/common/collect/ContiguousSet.java b/guava/src/com/google/common/collect/ContiguousSet.java index b3e4889d7cf7..ce9bb737f269 100644 --- a/guava/src/com/google/common/collect/ContiguousSet.java +++ b/guava/src/com/google/common/collect/ContiguousSet.java @@ -26,6 +26,8 @@ import java.util.NoSuchElementException; import java.util.Set; +import org.checkerframework.checker.pico.qual.Immutable; + /** * A sorted set of contiguous values in a given {@link DiscreteDomain}. Example: * @@ -51,6 +53,7 @@ @GwtCompatible(emulated = true) @SuppressWarnings("rawtypes") // allow ungenerified Comparable types @ElementTypesAreNonnullByDefault +@Immutable public abstract class ContiguousSet extends ImmutableSortedSet { /** * Returns a {@code ContiguousSet} containing the same values in the given domain {@linkplain diff --git a/guava/src/com/google/common/collect/Count.java b/guava/src/com/google/common/collect/Count.java index 0b819a3b5272..2d2d419d7cf0 100644 --- a/guava/src/com/google/common/collect/Count.java +++ b/guava/src/com/google/common/collect/Count.java @@ -17,13 +17,16 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A mutable value of type {@code int}, for multisets to use in tracking counts of values. * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault final class Count implements Serializable { @@ -61,7 +64,7 @@ public int hashCode(@UnknownSignedness Count this) { } @Override - public boolean equals(@CheckForNull Object obj) { + public boolean equals(@CheckForNull @Readonly Object obj) { return obj instanceof Count && ((Count) obj).value == value; } diff --git a/guava/src/com/google/common/collect/Cut.java b/guava/src/com/google/common/collect/Cut.java index 88fbbc8797c2..a1bcb404823f 100644 --- a/guava/src/com/google/common/collect/Cut.java +++ b/guava/src/com/google/common/collect/Cut.java @@ -21,7 +21,10 @@ import java.io.Serializable; import java.util.NoSuchElementException; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Implementation detail for the internal structure of {@link Range} instances. Represents a unique @@ -32,9 +35,11 @@ * * @author Kevin Bourrillion */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class Cut implements Comparable>, Serializable { +@Immutable +abstract class Cut implements Comparable>, Serializable { final C endpoint; Cut(C endpoint) { @@ -92,7 +97,7 @@ C endpoint() { @SuppressWarnings("unchecked") // catching CCE @Override - public boolean equals(@CheckForNull Object obj) { + public boolean equals(@CheckForNull @Readonly Object obj) { if (obj instanceof Cut) { // It might not really be a Cut, but we'll catch a CCE if it's not Cut that = (Cut) obj; @@ -115,13 +120,14 @@ public boolean equals(@CheckForNull Object obj) { * casting the type parameter is safe. */ @SuppressWarnings("unchecked") - static Cut belowAll() { + static Cut belowAll() { return (Cut) BelowAll.INSTANCE; } private static final long serialVersionUID = 0; - private static final class BelowAll extends Cut> { + @Immutable + private static final class BelowAll extends Cut<@Readonly Comparable> { private static final BelowAll INSTANCE = new BelowAll(); private BelowAll() { @@ -177,31 +183,31 @@ void describeAsUpperBound(StringBuilder sb) { } @Override - Comparable leastValueAbove(DiscreteDomain> domain) { + Comparable leastValueAbove(DiscreteDomain<@Readonly Comparable> domain) { return domain.minValue(); } @Override - Comparable greatestValueBelow(DiscreteDomain> domain) { + Comparable greatestValueBelow(DiscreteDomain<@Readonly Comparable> domain) { throw new AssertionError(); } @Override - Cut> canonical(DiscreteDomain> domain) { + Cut<@Readonly Comparable> canonical(DiscreteDomain<@Readonly Comparable> domain) { try { - return Cut.>belowValue(domain.minValue()); + return Cut.<@Readonly Comparable>belowValue(domain.minValue()); } catch (NoSuchElementException e) { return this; } } @Override - public int compareTo(Cut> o) { + public int compareTo(Cut<@Readonly Comparable> o) { return (o == this) ? 0 : -1; } @Override - public int hashCode(@UnknownSignedness BelowAll this) { + public int hashCode(@UnknownSignedness @Readonly BelowAll this) { return System.identityHashCode(this); } @@ -222,11 +228,12 @@ private Object readResolve() { * type C, so casting the type parameter is safe. */ @SuppressWarnings("unchecked") - static Cut aboveAll() { + static Cut aboveAll() { return (Cut) AboveAll.INSTANCE; } - private static final class AboveAll extends Cut> { + @Immutable + private static final class AboveAll extends Cut<@Readonly Comparable> { private static final AboveAll INSTANCE = new AboveAll(); private AboveAll() { @@ -308,11 +315,12 @@ private Object readResolve() { private static final long serialVersionUID = 0; } - static Cut belowValue(C endpoint) { + static Cut belowValue(C endpoint) { return new BelowValue<>(endpoint); } - private static final class BelowValue extends Cut { + @Immutable + private static final class BelowValue extends Cut { BelowValue(C endpoint) { super(checkNotNull(endpoint)); } @@ -392,11 +400,12 @@ public String toString() { private static final long serialVersionUID = 0; } - static Cut aboveValue(C endpoint) { + static Cut aboveValue(C endpoint) { return new AboveValue<>(endpoint); } - private static final class AboveValue extends Cut { + @Immutable + private static final class AboveValue extends Cut { AboveValue(C endpoint) { super(checkNotNull(endpoint)); } @@ -470,7 +479,7 @@ Cut canonical(DiscreteDomain domain) { } @Override - public int hashCode(@UnknownSignedness AboveValue this) { + public int hashCode(@UnknownSignedness @Readonly AboveValue this) { return ~endpoint.hashCode(); } diff --git a/guava/src/com/google/common/collect/DenseImmutableTable.java b/guava/src/com/google/common/collect/DenseImmutableTable.java index 4abf1eb81c76..11a413588883 100644 --- a/guava/src/com/google/common/collect/DenseImmutableTable.java +++ b/guava/src/com/google/common/collect/DenseImmutableTable.java @@ -18,19 +18,22 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap; -import com.google.errorprone.annotations.Immutable; +//import com.google.errorprone.annotations.Immutable; import com.google.j2objc.annotations.WeakOuter; import java.util.Map; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** A {@code RegularImmutableTable} optimized for dense data. */ @GwtCompatible -@Immutable(containerOf = {"R", "C", "V"}) +//@Immutable(containerOf = {"R", "C", "V"}) @ElementTypesAreNonnullByDefault -final class DenseImmutableTable extends RegularImmutableTable { +@Immutable +final class DenseImmutableTable extends RegularImmutableTable { private final ImmutableMap rowKeyToIndex; private final ImmutableMap columnKeyToIndex; private final ImmutableMap> rowMap; @@ -89,7 +92,8 @@ final class DenseImmutableTable extends RegularImmutableTable } /** An immutable map implementation backed by an indexed nullable array. */ - private abstract static class ImmutableArrayMap extends IteratorBasedImmutableMap { + @Immutable + private abstract static class ImmutableArrayMap extends IteratorBasedImmutableMap { private final int size; ImmutableArrayMap(int size) { @@ -122,7 +126,7 @@ ImmutableSet createKeySet() { @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { Integer keyIndex = keyToIndex().get(key); return (keyIndex == null) ? null : getValue(keyIndex); } @@ -148,6 +152,7 @@ protected Entry computeNext() { } } + @Immutable private final class Row extends ImmutableArrayMap { private final int rowIndex; @@ -173,6 +178,7 @@ boolean isPartialView() { } } + @Immutable private final class Column extends ImmutableArrayMap { private final int columnIndex; @@ -199,6 +205,7 @@ boolean isPartialView() { } @WeakOuter + @Immutable private final class RowMap extends ImmutableArrayMap> { private RowMap() { super(rowCounts.length); @@ -221,6 +228,7 @@ boolean isPartialView() { } @WeakOuter + @Immutable private final class ColumnMap extends ImmutableArrayMap> { private ColumnMap() { super(columnCounts.length); diff --git a/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java b/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java index f8c9b0c7bbf3..9401121ef938 100644 --- a/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java +++ b/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java @@ -17,7 +17,10 @@ import com.google.common.annotations.GwtIncompatible; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A descending wrapper around an {@code ImmutableSortedMultiset} @@ -25,8 +28,10 @@ * @author Louis Wasserman */ @SuppressWarnings("serial") // uses writeReplace, not default serialization +@AnnotatedFor("pico") @GwtIncompatible @ElementTypesAreNonnullByDefault +@Immutable final class DescendingImmutableSortedMultiset extends ImmutableSortedMultiset { private final transient ImmutableSortedMultiset forward; @@ -35,7 +40,7 @@ final class DescendingImmutableSortedMultiset extends ImmutableSortedMultiset } @Override - public @NonNegative int count(@CheckForNull @UnknownSignedness Object element) { + public @NonNegative int count(@CheckForNull @UnknownSignedness @Readonly Object element) { return forward.count(element); } diff --git a/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java b/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java index 235812e9d6c6..c721b542add3 100644 --- a/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java +++ b/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java @@ -19,15 +19,20 @@ import com.google.common.annotations.GwtIncompatible; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Skeletal implementation of {@link ImmutableSortedSet#descendingSet()}. * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtIncompatible @ElementTypesAreNonnullByDefault +@Immutable final class DescendingImmutableSortedSet extends ImmutableSortedSet { private final ImmutableSortedSet forward; @@ -37,7 +42,7 @@ final class DescendingImmutableSortedSet extends ImmutableSortedSet { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { return forward.contains(object); } diff --git a/guava/src/com/google/common/collect/DescendingMultiset.java b/guava/src/com/google/common/collect/DescendingMultiset.java index cec800966835..1bc7a603a65d 100644 --- a/guava/src/com/google/common/collect/DescendingMultiset.java +++ b/guava/src/com/google/common/collect/DescendingMultiset.java @@ -26,6 +26,8 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; @@ -37,7 +39,8 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -abstract class DescendingMultiset extends ForwardingMultiset +@ReceiverDependentMutable +abstract class DescendingMultiset extends ForwardingMultiset implements SortedMultiset { abstract SortedMultiset forwardMultiset(); diff --git a/guava/src/com/google/common/collect/DiscreteDomain.java b/guava/src/com/google/common/collect/DiscreteDomain.java index 0233feb76e10..1c3f8673a33b 100644 --- a/guava/src/com/google/common/collect/DiscreteDomain.java +++ b/guava/src/com/google/common/collect/DiscreteDomain.java @@ -27,6 +27,10 @@ import java.util.NoSuchElementException; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; + /** * A descriptor for a discrete {@code Comparable} domain such as all {@link Integer} * instances. A discrete domain is one that supports the three basic operations: {@link #next}, @@ -43,9 +47,11 @@ * @author Kevin Bourrillion * @since 10.0 */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class DiscreteDomain { +@Immutable +public abstract class DiscreteDomain { /** * Returns the discrete domain for values of type {@code Integer}. @@ -56,6 +62,7 @@ public static DiscreteDomain integers() { return IntegerDomain.INSTANCE; } + @Immutable private static final class IntegerDomain extends DiscreteDomain implements Serializable { private static final IntegerDomain INSTANCE = new IntegerDomain(); @@ -120,6 +127,7 @@ public static DiscreteDomain longs() { return LongDomain.INSTANCE; } + @Immutable private static final class LongDomain extends DiscreteDomain implements Serializable { private static final LongDomain INSTANCE = new LongDomain(); @@ -194,6 +202,7 @@ public static DiscreteDomain bigIntegers() { return BigIntegerDomain.INSTANCE; } + @Immutable private static final class BigIntegerDomain extends DiscreteDomain implements Serializable { private static final BigIntegerDomain INSTANCE = new BigIntegerDomain(); diff --git a/guava/src/com/google/common/collect/EmptyContiguousSet.java b/guava/src/com/google/common/collect/EmptyContiguousSet.java index af2397fc0fa5..e1a2c4c2dc02 100644 --- a/guava/src/com/google/common/collect/EmptyContiguousSet.java +++ b/guava/src/com/google/common/collect/EmptyContiguousSet.java @@ -20,6 +20,7 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -30,6 +31,7 @@ @GwtCompatible(emulated = true) @SuppressWarnings("rawtypes") // allow ungenerified Comparable types @ElementTypesAreNonnullByDefault +@Immutable final class EmptyContiguousSet extends ContiguousSet { EmptyContiguousSet(DiscreteDomain domain) { super(domain); diff --git a/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java b/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java index 5213d3411472..e91b96f7b418 100644 --- a/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java +++ b/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java @@ -17,6 +17,8 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -24,17 +26,18 @@ * * @author Jared Levy */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -class EmptyImmutableListMultimap extends ImmutableListMultimap { +@Immutable +class EmptyImmutableListMultimap extends ImmutableListMultimap<@Immutable Object, @Immutable Object> { static final EmptyImmutableListMultimap INSTANCE = new EmptyImmutableListMultimap(); private EmptyImmutableListMultimap() { - super(ImmutableMap.>of(), 0); + super(ImmutableMap.<@Immutable Object, ImmutableList<@Readonly Object>>of(), 0); } - private Object readResolve() { + private @Immutable Object readResolve() { return INSTANCE; // preserve singleton property } diff --git a/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java b/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java index 5e6e3c24f51e..60cab2239f4e 100644 --- a/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java +++ b/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java @@ -17,6 +17,8 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -27,11 +29,12 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -class EmptyImmutableSetMultimap extends ImmutableSetMultimap { +@Immutable +class EmptyImmutableSetMultimap extends ImmutableSetMultimap<@Immutable Object, @Readonly Object> { static final EmptyImmutableSetMultimap INSTANCE = new EmptyImmutableSetMultimap(); private EmptyImmutableSetMultimap() { - super(ImmutableMap.>of(), 0, null); + super(ImmutableMap.<@Immutable Object, ImmutableSet>of(), 0, null); } private Object readResolve() { diff --git a/guava/src/com/google/common/collect/EnumBiMap.java b/guava/src/com/google/common/collect/EnumBiMap.java index 7eff19d7c977..5adfeba51537 100644 --- a/guava/src/com/google/common/collect/EnumBiMap.java +++ b/guava/src/com/google/common/collect/EnumBiMap.java @@ -27,6 +27,7 @@ import java.util.EnumMap; import java.util.Map; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -44,7 +45,7 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -public final class EnumBiMap, V extends Enum> extends AbstractBiMap { +public final class EnumBiMap, V extends @Immutable Enum> extends AbstractBiMap { private transient Class keyType; private transient Class valueType; diff --git a/guava/src/com/google/common/collect/EnumHashBiMap.java b/guava/src/com/google/common/collect/EnumHashBiMap.java index 960575542679..9b419cc03833 100644 --- a/guava/src/com/google/common/collect/EnumHashBiMap.java +++ b/guava/src/com/google/common/collect/EnumHashBiMap.java @@ -29,6 +29,10 @@ import java.util.Map; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -44,10 +48,11 @@ * @author Mike Bostock * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -public final class EnumHashBiMap, V extends @Nullable Object> +@ReceiverDependentMutable +public final class EnumHashBiMap, V extends @Nullable @Immutable Object> extends AbstractBiMap { private transient Class keyType; @@ -56,7 +61,7 @@ public final class EnumHashBiMap, V extends @Nullable Object> * * @param keyType the key type */ - public static , V extends @Nullable Object> EnumHashBiMap create( + public static , V extends @Nullable @Immutable Object> EnumHashBiMap create( Class keyType) { return new EnumHashBiMap<>(keyType); } @@ -71,7 +76,7 @@ public final class EnumHashBiMap, V extends @Nullable Object> * @throws IllegalArgumentException if map is not an {@code EnumBiMap} or an {@code EnumHashBiMap} * instance and contains no mappings */ - public static , V extends @Nullable Object> EnumHashBiMap create( + public static , V extends @Nullable @Immutable Object> EnumHashBiMap create( Map map) { EnumHashBiMap bimap = create(EnumBiMap.inferKeyType(map)); bimap.putAll(map); @@ -88,7 +93,7 @@ private EnumHashBiMap(Class keyType) { // Overriding these 3 methods to show that values may be null (but not keys) @Override - K checkKey(K key) { + K checkKey(@Readonly EnumHashBiMap this, K key) { return checkNotNull(key); } @@ -97,7 +102,7 @@ K checkKey(K key) { @SuppressWarnings("RedundantOverride") // b/192446478: RedundantOverride ignores some annotations. // TODO(b/192446998): Remove this override after tools understand nullness better. @CheckForNull - public V put(K key, @ParametricNullness V value) { + public V put(@Mutable EnumHashBiMap this, K key, @ParametricNullness V value) { return super.put(key, value); } @@ -106,12 +111,12 @@ public V put(K key, @ParametricNullness V value) { @SuppressWarnings("RedundantOverride") // b/192446478: RedundantOverride ignores some annotations. // TODO(b/192446998): Remove this override after tools understand nullness better. @CheckForNull - public V forcePut(K key, @ParametricNullness V value) { + public V forcePut(@Mutable EnumHashBiMap this, K key, @ParametricNullness V value) { return super.forcePut(key, value); } /** Returns the associated key type. */ - public Class keyType() { + public Class keyType(@Readonly EnumHashBiMap this) { return keyType; } @@ -141,5 +146,5 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo @Pure @Override -public boolean containsValue(@Nullable @UnknownSignedness Object arg0) { return super.containsValue(arg0); } +public boolean containsValue(@Readonly EnumHashBiMap this, @Nullable @UnknownSignedness @Readonly Object arg0) { return super.containsValue(arg0); } } diff --git a/guava/src/com/google/common/collect/ExplicitOrdering.java b/guava/src/com/google/common/collect/ExplicitOrdering.java index 8f6454b6c01d..1772b196c4f4 100644 --- a/guava/src/com/google/common/collect/ExplicitOrdering.java +++ b/guava/src/com/google/common/collect/ExplicitOrdering.java @@ -21,18 +21,21 @@ import java.util.List; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; + import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; /** An ordering that compares objects according to a given order. */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -final class ExplicitOrdering extends Ordering implements Serializable { +final class ExplicitOrdering extends Ordering implements Serializable { final ImmutableMap rankMap; - ExplicitOrdering(List valuesInOrder) { + ExplicitOrdering(@Readonly List valuesInOrder) { this(Maps.indexMap(valuesInOrder)); } @@ -56,7 +59,7 @@ private int rank(T value) { @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@CheckForNull @Readonly Object object) { if (object instanceof ExplicitOrdering) { ExplicitOrdering that = (ExplicitOrdering) object; return this.rankMap.equals(that.rankMap); diff --git a/guava/src/com/google/common/collect/FilteredEntryMultimap.java b/guava/src/com/google/common/collect/FilteredEntryMultimap.java index f76c2ab90f4d..3ce476733874 100644 --- a/guava/src/com/google/common/collect/FilteredEntryMultimap.java +++ b/guava/src/com/google/common/collect/FilteredEntryMultimap.java @@ -36,6 +36,9 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -46,7 +49,8 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -class FilteredEntryMultimap +@ReceiverDependentMutable +class FilteredEntryMultimap extends AbstractMultimap implements FilteredMultimap { final Multimap unfiltered; final Predicate> predicate; @@ -88,7 +92,7 @@ public boolean apply(@ParametricNullness V value) { } } - static Collection filterCollection( + static Collection filterCollection( Collection collection, Predicate predicate) { if (collection instanceof Set) { return Sets.filter((Set) collection, predicate); @@ -98,12 +102,12 @@ public boolean apply(@ParametricNullness V value) { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return asMap().get(key) != null; } @Override - public Collection removeAll(@CheckForNull Object key) { + public Collection removeAll(@CheckForNull @Readonly Object key) { return MoreObjects.firstNonNull(asMap().remove(key), unmodifiableEmptyCollection()); } @@ -171,7 +175,7 @@ boolean removeEntriesIf(Predicate>> predicate) { @WeakOuter class AsMap extends ViewCachingAbstractMap> { @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return get(key) != null; } @@ -182,7 +186,7 @@ public void clear() { @Override @CheckForNull - public Collection get(@CheckForNull @UnknownSignedness Object key) { + public Collection get(@CheckForNull @UnknownSignedness @Readonly Object key) { Collection result = unfiltered.asMap().get(key); if (result == null) { return null; @@ -195,7 +199,7 @@ public Collection get(@CheckForNull @UnknownSignedness Object key) { @Override @CheckForNull - public Collection remove(@CheckForNull @UnknownSignedness Object key) { + public @Immutable Collection remove(@CheckForNull @UnknownSignedness @Readonly Object key) { Collection collection = unfiltered.asMap().get(key); if (collection == null) { return null; @@ -354,7 +358,7 @@ class Keys extends Multimaps.Keys { } @Override - public int remove(@CheckForNull Object key, int occurrences) { + public int remove(@CheckForNull @Readonly Object key, int occurrences) { checkNonnegative(occurrences, "occurrences"); if (occurrences == 0) { return count(key); diff --git a/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java b/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java index 20413f8c4096..d25e7933b294 100644 --- a/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java +++ b/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java @@ -22,48 +22,56 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Implementation of {@link Multimaps#filterEntries(SetMultimap, Predicate)}. * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -final class FilteredEntrySetMultimap +@ReceiverDependentMutable +final class FilteredEntrySetMultimap extends FilteredEntryMultimap implements FilteredSetMultimap { - FilteredEntrySetMultimap(SetMultimap unfiltered, Predicate> predicate) { + FilteredEntrySetMultimap(@ReceiverDependentMutable SetMultimap unfiltered, Predicate> predicate) { super(unfiltered, predicate); } @Override - public SetMultimap unfiltered() { - return (SetMultimap) unfiltered; + public @PolyMutable SetMultimap unfiltered(@PolyMutable FilteredEntrySetMultimap this) { + return (@PolyMutable SetMultimap) unfiltered; } @Override - public Set get(@ParametricNullness K key) { - return (Set) super.get(key); + public @PolyMutable Set get(@PolyMutable FilteredEntrySetMultimap this, @ParametricNullness K key) { + return (@PolyMutable Set) super.get(key); } @Override - public Set removeAll(@CheckForNull Object key) { - return (Set) super.removeAll(key); + public @Readonly Set removeAll(@Mutable FilteredEntrySetMultimap this, @CheckForNull @Readonly Object key) { + return (@Readonly Set) super.removeAll(key); } @Override - public Set replaceValues(@ParametricNullness K key, Iterable values) { + public Set replaceValues(@Mutable FilteredEntrySetMultimap this, @ParametricNullness K key, Iterable values) { return (Set) super.replaceValues(key, values); } @Override - Set> createEntries() { + @PolyMutable Set<@PolyMutable Entry> createEntries(@PolyMutable FilteredEntrySetMultimap this) { return Sets.filter(unfiltered().entries(), entryPredicate()); } @Override - public Set> entries() { - return (Set>) super.entries(); + public @PolyMutable Set<@PolyMutable Entry> entries(@PolyMutable FilteredEntrySetMultimap this) { + return (@PolyMutable Set<@PolyMutable Entry>) super.entries(); } } diff --git a/guava/src/com/google/common/collect/FilteredKeyListMultimap.java b/guava/src/com/google/common/collect/FilteredKeyListMultimap.java index c82c8daf770d..355b8e4e9997 100644 --- a/guava/src/com/google/common/collect/FilteredKeyListMultimap.java +++ b/guava/src/com/google/common/collect/FilteredKeyListMultimap.java @@ -21,6 +21,8 @@ import java.util.List; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; /** * Implementation of {@link Multimaps#filterKeys(ListMultimap, Predicate)}. @@ -29,7 +31,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -final class FilteredKeyListMultimap +final class FilteredKeyListMultimap extends FilteredKeyMultimap implements ListMultimap { FilteredKeyListMultimap(ListMultimap unfiltered, Predicate keyPredicate) { super(unfiltered, keyPredicate); @@ -46,7 +48,7 @@ public List get(@ParametricNullness K key) { } @Override - public List removeAll(@CheckForNull Object key) { + public List removeAll(@CheckForNull @Readonly Object key) { return (List) super.removeAll(key); } diff --git a/guava/src/com/google/common/collect/FilteredKeyMultimap.java b/guava/src/com/google/common/collect/FilteredKeyMultimap.java index 0351fdcc0f78..6c471e57d754 100644 --- a/guava/src/com/google/common/collect/FilteredKeyMultimap.java +++ b/guava/src/com/google/common/collect/FilteredKeyMultimap.java @@ -32,6 +32,9 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -41,7 +44,8 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -class FilteredKeyMultimap +@ReceiverDependentMutable +class FilteredKeyMultimap extends AbstractMultimap implements FilteredMultimap { final Multimap unfiltered; final Predicate keyPredicate; @@ -71,7 +75,7 @@ public int size() { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { if (unfiltered.containsKey(key)) { @SuppressWarnings("unchecked") // k is equal to a K, if not one itself K k = (K) key; @@ -81,11 +85,11 @@ public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { } @Override - public Collection removeAll(@CheckForNull Object key) { + public Collection removeAll(@CheckForNull @Readonly Object key) { return containsKey(key) ? unfiltered.removeAll(key) : unmodifiableEmptyCollection(); } - Collection unmodifiableEmptyCollection() { + @Immutable Collection unmodifiableEmptyCollection() { if (unfiltered instanceof SetMultimap) { return emptySet(); } else { @@ -114,7 +118,7 @@ public Collection get(@ParametricNullness K key) { } } - static class AddRejectingSet + static class AddRejectingSet extends ForwardingSet { @ParametricNullness final K key; @@ -139,7 +143,7 @@ protected Set delegate() { } } - static class AddRejectingList + static class AddRejectingList extends ForwardingList { @ParametricNullness final K key; diff --git a/guava/src/com/google/common/collect/FilteredKeySetMultimap.java b/guava/src/com/google/common/collect/FilteredKeySetMultimap.java index 22b4028142f9..90446b086b9d 100644 --- a/guava/src/com/google/common/collect/FilteredKeySetMultimap.java +++ b/guava/src/com/google/common/collect/FilteredKeySetMultimap.java @@ -22,6 +22,8 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -31,7 +33,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -final class FilteredKeySetMultimap +final class FilteredKeySetMultimap extends FilteredKeyMultimap implements FilteredSetMultimap { FilteredKeySetMultimap(SetMultimap unfiltered, Predicate keyPredicate) { @@ -49,7 +51,7 @@ public Set get(@ParametricNullness K key) { } @Override - public Set removeAll(@CheckForNull Object key) { + public Set removeAll(@CheckForNull @Readonly Object key) { return (Set) super.removeAll(key); } diff --git a/guava/src/com/google/common/collect/FilteredMultimap.java b/guava/src/com/google/common/collect/FilteredMultimap.java index 4e1fa066f80b..f51aa34a9329 100644 --- a/guava/src/com/google/common/collect/FilteredMultimap.java +++ b/guava/src/com/google/common/collect/FilteredMultimap.java @@ -20,17 +20,24 @@ import com.google.common.base.Predicate; import java.util.Map.Entry; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * An interface for all filtered multimap types. * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -interface FilteredMultimap +@ReceiverDependentMutable +interface FilteredMultimap extends Multimap { - Multimap unfiltered(); + @PolyMutable Multimap unfiltered(@PolyMutable FilteredMultimap this); - Predicate> entryPredicate(); + Predicate> entryPredicate(@Readonly FilteredMultimap this); } diff --git a/guava/src/com/google/common/collect/FilteredMultimapValues.java b/guava/src/com/google/common/collect/FilteredMultimapValues.java index 5954d651e677..bf814bee1418 100644 --- a/guava/src/com/google/common/collect/FilteredMultimapValues.java +++ b/guava/src/com/google/common/collect/FilteredMultimapValues.java @@ -28,6 +28,10 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -37,11 +41,12 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -final class FilteredMultimapValues +@ReceiverDependentMutable +final class FilteredMultimapValues extends AbstractCollection { @Weak private final FilteredMultimap multimap; - FilteredMultimapValues(FilteredMultimap multimap) { + FilteredMultimapValues(@ReceiverDependentMutable FilteredMultimap multimap) { this.multimap = checkNotNull(multimap); } @@ -51,17 +56,17 @@ public Iterator iterator() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly FilteredMultimapValues this, @CheckForNull @UnknownSignedness @Readonly Object o) { return multimap.containsValue(o); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly FilteredMultimapValues this) { return multimap.size(); } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable FilteredMultimapValues this, @CheckForNull @UnknownSignedness @Readonly Object o) { Predicate> entryPredicate = multimap.entryPredicate(); for (Iterator> unfilteredItr = multimap.unfiltered().entries().iterator(); unfilteredItr.hasNext(); ) { @@ -75,7 +80,7 @@ public boolean remove(@CheckForNull @UnknownSignedness Object o) { } @Override - public boolean removeAll(Collection c) { + public boolean removeAll(@Mutable FilteredMultimapValues this, @Readonly Collection c) { return Iterables.removeIf( multimap.unfiltered().entries(), // explicit > is required to build with JDK6 @@ -84,7 +89,7 @@ public boolean removeAll(Collection c) { } @Override - public boolean retainAll(Collection c) { + public boolean retainAll(@Mutable FilteredMultimapValues this, @Readonly Collection c) { return Iterables.removeIf( multimap.unfiltered().entries(), // explicit > is required to build with JDK6 @@ -94,7 +99,7 @@ public boolean retainAll(Collection c) { } @Override - public void clear() { + public void clear(@Mutable FilteredMultimapValues this) { multimap.clear(); } } diff --git a/guava/src/com/google/common/collect/FilteredSetMultimap.java b/guava/src/com/google/common/collect/FilteredSetMultimap.java index 8e2ff7c0c1a6..042c9b104319 100644 --- a/guava/src/com/google/common/collect/FilteredSetMultimap.java +++ b/guava/src/com/google/common/collect/FilteredSetMultimap.java @@ -18,16 +18,23 @@ import com.google.common.annotations.GwtCompatible; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A supertype for filtered {@link SetMultimap} implementations. * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -interface FilteredSetMultimap +@ReceiverDependentMutable +interface FilteredSetMultimap extends FilteredMultimap, SetMultimap { @Override - SetMultimap unfiltered(); + @PolyMutable SetMultimap unfiltered(@PolyMutable FilteredSetMultimap this); } diff --git a/guava/src/com/google/common/collect/FluentIterable.java b/guava/src/com/google/common/collect/FluentIterable.java index 11bda3bde95f..7dd663d1c260 100644 --- a/guava/src/com/google/common/collect/FluentIterable.java +++ b/guava/src/com/google/common/collect/FluentIterable.java @@ -35,6 +35,9 @@ import java.util.stream.Stream; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.CFComment; /** * A discouraged (but not deprecated) precursor to Java's superior {@link Stream} library. @@ -110,7 +113,7 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -public abstract class FluentIterable implements Iterable { +public abstract class FluentIterable implements Iterable { // We store 'iterable' and use it instead of 'this' to allow Iterables to perform instanceof // checks on the _original_ iterable when FluentIterable.from is used. // To avoid a self retain cycle under j2objc, we store Optional.absent() instead of @@ -138,7 +141,7 @@ private Iterable getDelegate() { *

{@code Stream} equivalent: {@link Collection#stream} if {@code iterable} is a {@link * Collection}; {@link Streams#stream(Iterable)} otherwise. */ - public static FluentIterable from(final Iterable iterable) { + public static FluentIterable from(final Iterable iterable) { return (iterable instanceof FluentIterable) ? (FluentIterable) iterable : new FluentIterable(iterable) { @@ -160,7 +163,7 @@ public Iterator iterator() { * @since 20.0 (since 18.0 as an overload of {@code of}) */ @Beta - public static FluentIterable from(E[] elements) { + public static FluentIterable from(E[] elements) { return from(Arrays.asList(elements)); } @@ -176,7 +179,7 @@ public Iterator iterator() { @InlineMe( replacement = "checkNotNull(iterable)", staticImports = {"com.google.common.base.Preconditions.checkNotNull"}) - public static FluentIterable from(FluentIterable iterable) { + public static FluentIterable from(FluentIterable iterable) { return checkNotNull(iterable); } @@ -193,7 +196,7 @@ public Iterator iterator() { * @since 20.0 */ @Beta - public static FluentIterable concat( + public static FluentIterable concat( Iterable a, Iterable b) { return concatNoDefensiveCopy(a, b); } @@ -212,7 +215,7 @@ public Iterator iterator() { * @since 20.0 */ @Beta - public static FluentIterable concat( + public static FluentIterable concat( Iterable a, Iterable b, Iterable c) { return concatNoDefensiveCopy(a, b, c); } @@ -232,7 +235,7 @@ public Iterator iterator() { * @since 20.0 */ @Beta - public static FluentIterable concat( + public static FluentIterable concat( Iterable a, Iterable b, Iterable c, @@ -256,7 +259,7 @@ public Iterator iterator() { * @since 20.0 */ @Beta - public static FluentIterable concat( + public static FluentIterable concat( Iterable... inputs) { return concatNoDefensiveCopy(Arrays.copyOf(inputs, inputs.length)); } @@ -276,7 +279,7 @@ public Iterator iterator() { * @since 20.0 */ @Beta - public static FluentIterable concat( + public static FluentIterable concat( final Iterable> inputs) { checkNotNull(inputs); return new FluentIterable() { @@ -288,7 +291,7 @@ public Iterator iterator() { } /** Concatenates a varargs array of iterables without making a defensive copy of the array. */ - private static FluentIterable concatNoDefensiveCopy( + private static FluentIterable concatNoDefensiveCopy( final Iterable... inputs) { for (Iterable input : inputs) { checkNotNull(input); @@ -316,7 +319,7 @@ public Iterator get(int i) { * @since 20.0 */ @Beta - public static FluentIterable of() { + public static FluentIterable of() { return FluentIterable.from(Collections.emptyList()); } @@ -329,7 +332,7 @@ public Iterator get(int i) { * @since 20.0 */ @Beta - public static FluentIterable of( + public static FluentIterable of( @ParametricNullness E element, E... elements) { return from(Lists.asList(element, elements)); } @@ -361,7 +364,7 @@ public final int size() { * *

{@code Stream} equivalent: {@code stream.anyMatch(Predicate.isEqual(target))}. */ - public final boolean contains(@CheckForNull Object target) { + public final boolean contains(@CheckForNull @Readonly Object target) { return Iterables.contains(getDelegate(), target); } @@ -486,7 +489,7 @@ public final Optional firstMatch(Predicate predicate) { * *

{@code Stream} equivalent: {@link Stream#map}. */ - public final FluentIterable transform( + public final FluentIterable transform( Function function) { return from(Iterables.transform(getDelegate(), function)); } @@ -504,7 +507,7 @@ public final Optional firstMatch(Predicate predicate) { * * @since 13.0 (required {@code Function>} until 14.0) */ - public FluentIterable transformAndConcat( + public FluentIterable transformAndConcat( Function> function) { return FluentIterable.concat(transform(function)); } @@ -712,7 +715,8 @@ public final ImmutableMultiset toMultiset() { * @since 14.0 */ @SuppressWarnings("nullness") // Unsafe, but we can't do much about it now. - public final ImmutableMap toMap(Function valueFunction) { + @CFComment("Aosen: would it be better if we are using different type parameter such K for map? Why using E from the iterable?") + public final ImmutableMap<@Immutable E, V> toMap(Function valueFunction) { return Maps.toMap(getDelegate(), valueFunction); } @@ -735,7 +739,7 @@ public final ImmutableMap toMap(Function valueFunction) * @since 14.0 */ @SuppressWarnings("nullness") // Unsafe, but we can't do much about it now. - public final ImmutableListMultimap index(Function keyFunction) { + public final ImmutableListMultimap index(Function keyFunction) { return Multimaps.index(getDelegate(), keyFunction); } @@ -770,7 +774,7 @@ public final ImmutableListMultimap index(Function keyFun * @since 14.0 */ @SuppressWarnings("nullness") // Unsafe, but we can't do much about it now. - public final ImmutableMap uniqueIndex(Function keyFunction) { + public final ImmutableMap uniqueIndex(Function keyFunction) { return Maps.uniqueIndex(getDelegate(), keyFunction); } diff --git a/guava/src/com/google/common/collect/ForwardingCollection.java b/guava/src/com/google/common/collect/ForwardingCollection.java index 80eeb3cab410..4f252f9144cd 100644 --- a/guava/src/com/google/common/collect/ForwardingCollection.java +++ b/guava/src/com/google/common/collect/ForwardingCollection.java @@ -25,6 +25,10 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; @@ -52,10 +56,11 @@ * @author Louis Wasserman * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingCollection extends ForwardingObject +@ReceiverDependentMutable +public abstract class ForwardingCollection extends ForwardingObject implements Collection { // TODO(lowasser): identify places where thread safety is actually lost @@ -63,83 +68,83 @@ public abstract class ForwardingCollection extends F protected ForwardingCollection() {} @Override - protected abstract Collection delegate(); + protected abstract @PolyMutable Collection delegate(@PolyMutable ForwardingCollection this); @Override - public Iterator iterator() { + public Iterator iterator(@Readonly ForwardingCollection this) { return delegate().iterator(); } @Pure @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly ForwardingCollection this) { return delegate().size(); } @CanIgnoreReturnValue @Override - public boolean removeAll(Collection collection) { + public boolean removeAll(@Mutable ForwardingCollection this, Collection collection) { return delegate().removeAll(collection); } @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly ForwardingCollection this) { return delegate().isEmpty(); } @Pure @Override @SuppressWarnings("nullness:argument") - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@Readonly ForwardingCollection this, @CheckForNull @UnknownSignedness @Readonly Object object) { return delegate().contains(object); } @CanIgnoreReturnValue @Override - public boolean add(@ParametricNullness E element) { + public boolean add(@Mutable ForwardingCollection this, @ParametricNullness E element) { return delegate().add(element); } @CanIgnoreReturnValue @Override @SuppressWarnings("nullness:argument") - public boolean remove(@CheckForNull @UnknownSignedness Object object) { + public boolean remove(@Mutable ForwardingCollection this, @CheckForNull @UnknownSignedness Object object) { return delegate().remove(object); } @Pure @Override - public boolean containsAll(Collection collection) { + public boolean containsAll(@Readonly ForwardingCollection this, @Readonly Collection collection) { return delegate().containsAll(collection); } @CanIgnoreReturnValue @Override - public boolean addAll(Collection collection) { + public boolean addAll(@Mutable ForwardingCollection this, @Readonly Collection collection) { return delegate().addAll(collection); } @CanIgnoreReturnValue @Override - public boolean retainAll(Collection collection) { + public boolean retainAll(@Mutable ForwardingCollection this, @Readonly Collection collection) { return delegate().retainAll(collection); } @Override - public void clear() { + public void clear(@Mutable ForwardingCollection this) { delegate().clear(); } @Override - public @PolyNull @PolySigned Object[] toArray(ForwardingCollection<@PolyNull @PolySigned E> this) { + public @PolyNull @PolySigned @PolyMutable Object @ReceiverDependentMutable [] toArray(ForwardingCollection<@PolyNull @PolySigned @PolyMutable E> this) { return delegate().toArray(); } @CanIgnoreReturnValue @Override @SuppressWarnings("nullness:return") - public T[] toArray(@PolyNull T[] array) { + public T @ReceiverDependentMutable [] toArray(@ReceiverDependentMutable ForwardingCollection this, @PolyNull T @ReceiverDependentMutable[] array) { return delegate().toArray(array); } @@ -150,7 +155,7 @@ public void clear() { * * @since 7.0 */ - protected boolean standardContains(@CheckForNull Object object) { + protected boolean standardContains(@Readonly ForwardingCollection this, @CheckForNull @Readonly Object object) { return Iterators.contains(iterator(), object); } @@ -161,7 +166,7 @@ protected boolean standardContains(@CheckForNull Object object) { * * @since 7.0 */ - protected boolean standardContainsAll(Collection collection) { + protected boolean standardContainsAll(@Readonly ForwardingCollection this, @Readonly Collection collection) { return Collections2.containsAllImpl(this, collection); } @@ -171,7 +176,7 @@ protected boolean standardContainsAll(Collection collection) { * * @since 7.0 */ - protected boolean standardAddAll(Collection collection) { + protected boolean standardAddAll(@Mutable ForwardingCollection this, @Readonly Collection collection) { return Iterators.addAll(this, collection.iterator()); } @@ -182,7 +187,7 @@ protected boolean standardAddAll(Collection collection) { * * @since 7.0 */ - protected boolean standardRemove(@CheckForNull Object object) { + protected boolean standardRemove(@Mutable ForwardingCollection this, @CheckForNull @Readonly Object object) { Iterator iterator = iterator(); while (iterator.hasNext()) { if (Objects.equal(iterator.next(), object)) { @@ -200,7 +205,7 @@ protected boolean standardRemove(@CheckForNull Object object) { * * @since 7.0 */ - protected boolean standardRemoveAll(Collection collection) { + protected boolean standardRemoveAll(@Mutable ForwardingCollection this, @Readonly Collection collection) { return Iterators.removeAll(iterator(), collection); } @@ -211,7 +216,7 @@ protected boolean standardRemoveAll(Collection collection) { * * @since 7.0 */ - protected boolean standardRetainAll(Collection collection) { + protected boolean standardRetainAll(@Mutable ForwardingCollection this, @Readonly Collection collection) { return Iterators.retainAll(iterator(), collection); } @@ -222,7 +227,7 @@ protected boolean standardRetainAll(Collection collection) { * * @since 7.0 */ - protected void standardClear() { + protected void standardClear(@Mutable ForwardingCollection this) { Iterators.clear(iterator()); } @@ -233,7 +238,7 @@ protected void standardClear() { * * @since 7.0 */ - protected boolean standardIsEmpty() { + protected boolean standardIsEmpty(@Readonly ForwardingCollection this) { return !iterator().hasNext(); } @@ -244,7 +249,7 @@ protected boolean standardIsEmpty() { * * @since 7.0 */ - protected String standardToString() { + protected String standardToString(@Readonly ForwardingCollection this) { return Collections2.toStringImpl(this); } @@ -255,8 +260,8 @@ protected String standardToString() { * * @since 7.0 */ - protected @Nullable Object[] standardToArray() { - @Nullable Object[] newArray = new @Nullable Object[size()]; + protected @Nullable @PolyMutable Object @ReceiverDependentMutable [] standardToArray(ForwardingCollection<@PolyMutable E> this) { + @Nullable @PolyMutable Object @ReceiverDependentMutable [] newArray = new @Nullable @PolyMutable Object @ReceiverDependentMutable [size()]; return toArray(newArray); } @@ -267,7 +272,7 @@ protected String standardToString() { * * @since 7.0 */ - protected T[] standardToArray(T[] array) { + protected T[] standardToArray(T @ReceiverDependentMutable [] array) { return ObjectArrays.toArrayImpl(this, array); } } diff --git a/guava/src/com/google/common/collect/ForwardingConcurrentMap.java b/guava/src/com/google/common/collect/ForwardingConcurrentMap.java index e3dc0ee2e259..044738034647 100644 --- a/guava/src/com/google/common/collect/ForwardingConcurrentMap.java +++ b/guava/src/com/google/common/collect/ForwardingConcurrentMap.java @@ -21,6 +21,9 @@ import java.util.concurrent.ConcurrentMap; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.framework.qual.AnnotatedFor; @@ -42,7 +45,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingConcurrentMap extends ForwardingMap +@ReceiverDependentMutable +public abstract class ForwardingConcurrentMap extends ForwardingMap implements ConcurrentMap { /** Constructor for use by subclasses. */ @@ -62,7 +66,7 @@ public V putIfAbsent(K key, V value) { @CanIgnoreReturnValue @Override @SuppressWarnings("nullness:argument") - public boolean remove(@CheckForNull @UnknownSignedness Object key, @CheckForNull @UnknownSignedness Object value) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object key, @CheckForNull @UnknownSignedness @Readonly Object value) { return delegate().remove(key, value); } diff --git a/guava/src/com/google/common/collect/ForwardingDeque.java b/guava/src/com/google/common/collect/ForwardingDeque.java index 571535cab917..37c76ae2d3a5 100644 --- a/guava/src/com/google/common/collect/ForwardingDeque.java +++ b/guava/src/com/google/common/collect/ForwardingDeque.java @@ -22,6 +22,11 @@ import java.util.Iterator; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A deque which forwards all its method calls to another deque. Subclasses should override one or @@ -40,117 +45,119 @@ * @author Kurt Alfred Kluever * @since 12.0 */ +@AnnotatedFor("pico") @GwtIncompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingDeque extends ForwardingQueue +@ReceiverDependentMutable +public abstract class ForwardingDeque extends ForwardingQueue implements Deque { /** Constructor for use by subclasses. */ protected ForwardingDeque() {} @Override - protected abstract Deque delegate(); + protected abstract @PolyMutable Deque delegate(@PolyMutable ForwardingDeque this); @Override - public void addFirst(@ParametricNullness E e) { + public void addFirst(@Mutable ForwardingDeque this, @ParametricNullness E e) { delegate().addFirst(e); } @Override - public void addLast(@ParametricNullness E e) { + public void addLast(@Mutable ForwardingDeque this, @ParametricNullness E e) { delegate().addLast(e); } @Override - public Iterator descendingIterator() { + public Iterator descendingIterator(@Readonly ForwardingDeque this) { return delegate().descendingIterator(); } @Override @ParametricNullness - public E getFirst() { + public E getFirst(@Readonly ForwardingDeque this) { return delegate().getFirst(); } @Override @ParametricNullness - public E getLast() { + public E getLast(@Readonly ForwardingDeque this) { return delegate().getLast(); } @CanIgnoreReturnValue // TODO(cpovirk): Consider removing this? @Override - public boolean offerFirst(@ParametricNullness E e) { + public boolean offerFirst(@Mutable ForwardingDeque this, @ParametricNullness E e) { return delegate().offerFirst(e); } @CanIgnoreReturnValue // TODO(cpovirk): Consider removing this? @Override - public boolean offerLast(@ParametricNullness E e) { + public boolean offerLast(@Mutable ForwardingDeque this, @ParametricNullness E e) { return delegate().offerLast(e); } @Override @CheckForNull - public E peekFirst() { + public E peekFirst(@Readonly ForwardingDeque this) { return delegate().peekFirst(); } @Override @CheckForNull - public E peekLast() { + public E peekLast(@Readonly ForwardingDeque this) { return delegate().peekLast(); } @CanIgnoreReturnValue // TODO(cpovirk): Consider removing this? @Override @CheckForNull - public E pollFirst() { + public E pollFirst(@Mutable ForwardingDeque this) { return delegate().pollFirst(); } @CanIgnoreReturnValue // TODO(cpovirk): Consider removing this? @Override @CheckForNull - public E pollLast() { + public E pollLast(@Mutable ForwardingDeque this) { return delegate().pollLast(); } @CanIgnoreReturnValue @Override @ParametricNullness - public E pop() { + public E pop(@Mutable ForwardingDeque this) { return delegate().pop(); } @Override - public void push(@ParametricNullness E e) { + public void push(@Mutable ForwardingDeque this, @ParametricNullness E e) { delegate().push(e); } @CanIgnoreReturnValue @Override @ParametricNullness - public E removeFirst() { + public E removeFirst(@Mutable ForwardingDeque this) { return delegate().removeFirst(); } @CanIgnoreReturnValue @Override @ParametricNullness - public E removeLast() { + public E removeLast(@Mutable ForwardingDeque this) { return delegate().removeLast(); } @CanIgnoreReturnValue @Override - public boolean removeFirstOccurrence(@CheckForNull Object o) { + public boolean removeFirstOccurrence(@Mutable ForwardingDeque this, @CheckForNull @Readonly Object o) { return delegate().removeFirstOccurrence(o); } @CanIgnoreReturnValue @Override - public boolean removeLastOccurrence(@CheckForNull Object o) { + public boolean removeLastOccurrence(@Mutable ForwardingDeque this, @CheckForNull @Readonly Object o) { return delegate().removeLastOccurrence(o); } } diff --git a/guava/src/com/google/common/collect/ForwardingImmutableCollection.java b/guava/src/com/google/common/collect/ForwardingImmutableCollection.java index 043fe5863593..79fd49ee3161 100644 --- a/guava/src/com/google/common/collect/ForwardingImmutableCollection.java +++ b/guava/src/com/google/common/collect/ForwardingImmutableCollection.java @@ -17,6 +17,7 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.checkerframework.checker.pico.qual.Immutable; /** * Dummy class that makes the GWT serialization policy happy. It isn't used on the server-side. @@ -25,6 +26,7 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@Immutable class ForwardingImmutableCollection { private ForwardingImmutableCollection() {} } diff --git a/guava/src/com/google/common/collect/ForwardingImmutableList.java b/guava/src/com/google/common/collect/ForwardingImmutableList.java index bd5480d589c4..0ba38aa393e8 100644 --- a/guava/src/com/google/common/collect/ForwardingImmutableList.java +++ b/guava/src/com/google/common/collect/ForwardingImmutableList.java @@ -17,14 +17,18 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Unused stub class, unreferenced under Java and manually emulated under GWT. * * @author Chris Povirk */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@Immutable abstract class ForwardingImmutableList { private ForwardingImmutableList() {} } diff --git a/guava/src/com/google/common/collect/ForwardingImmutableMap.java b/guava/src/com/google/common/collect/ForwardingImmutableMap.java index 22cc9ff8711c..70447c86ec91 100644 --- a/guava/src/com/google/common/collect/ForwardingImmutableMap.java +++ b/guava/src/com/google/common/collect/ForwardingImmutableMap.java @@ -17,14 +17,18 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Unused stub class, unreferenced under Java and manually emulated under GWT. * * @author Chris Povirk */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -abstract class ForwardingImmutableMap { +@Immutable +abstract class ForwardingImmutableMap { private ForwardingImmutableMap() {} } diff --git a/guava/src/com/google/common/collect/ForwardingImmutableSet.java b/guava/src/com/google/common/collect/ForwardingImmutableSet.java index 047d5fd32216..239a057b44e4 100644 --- a/guava/src/com/google/common/collect/ForwardingImmutableSet.java +++ b/guava/src/com/google/common/collect/ForwardingImmutableSet.java @@ -17,14 +17,18 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Unused stub class, unreferenced under Java and manually emulated under GWT. * * @author Chris Povirk */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@Immutable abstract class ForwardingImmutableSet { private ForwardingImmutableSet() {} } diff --git a/guava/src/com/google/common/collect/ForwardingIterator.java b/guava/src/com/google/common/collect/ForwardingIterator.java index ecc7f1b9ac1d..e28fa5dc160c 100644 --- a/guava/src/com/google/common/collect/ForwardingIterator.java +++ b/guava/src/com/google/common/collect/ForwardingIterator.java @@ -20,6 +20,8 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Iterator; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -40,7 +42,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingIterator extends ForwardingObject +@ReceiverDependentMutable +public abstract class ForwardingIterator extends ForwardingObject implements Iterator { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/collect/ForwardingList.java b/guava/src/com/google/common/collect/ForwardingList.java index d20eb3624c2e..a65136033906 100644 --- a/guava/src/com/google/common/collect/ForwardingList.java +++ b/guava/src/com/google/common/collect/ForwardingList.java @@ -25,6 +25,10 @@ import java.util.ListIterator; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -55,10 +59,11 @@ * @author Louis Wasserman * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingList extends ForwardingCollection +@ReceiverDependentMutable +public abstract class ForwardingList extends ForwardingCollection implements List { // TODO(lowasser): identify places where thread safety is actually lost @@ -66,78 +71,78 @@ public abstract class ForwardingList extends Forward protected ForwardingList() {} @Override - protected abstract List delegate(); + protected abstract @PolyMutable List delegate(@PolyMutable ForwardingList this); @Override - public void add(int index, @ParametricNullness E element) { + public void add(@Mutable ForwardingList this, int index, @ParametricNullness E element) { delegate().add(index, element); } @CanIgnoreReturnValue @Override - public boolean addAll(int index, Collection elements) { + public boolean addAll(@Mutable ForwardingList this, int index, @Readonly Collection elements) { return delegate().addAll(index, elements); } @Override @ParametricNullness - public E get(int index) { + public E get(@Readonly ForwardingList this, int index) { return delegate().get(index); } @Pure @Override @SuppressWarnings("nullness:argument") - public int indexOf(@CheckForNull @UnknownSignedness Object element) { + public int indexOf(@Readonly ForwardingList this, @CheckForNull @UnknownSignedness @Readonly Object element) { return delegate().indexOf(element); } @Pure @Override @SuppressWarnings("nullness:argument") - public int lastIndexOf(@CheckForNull @UnknownSignedness Object element) { + public int lastIndexOf(@Readonly ForwardingList this, @CheckForNull @UnknownSignedness @Readonly Object element) { return delegate().lastIndexOf(element); } @Override - public ListIterator listIterator() { + public ListIterator listIterator(@Readonly ForwardingList this) { return delegate().listIterator(); } @Override - public ListIterator listIterator(int index) { + public ListIterator listIterator(@Readonly ForwardingList this, int index) { return delegate().listIterator(index); } @CanIgnoreReturnValue @Override @ParametricNullness - public E remove(int index) { + public E remove(@Mutable ForwardingList this, int index) { return delegate().remove(index); } @CanIgnoreReturnValue @Override @ParametricNullness - public E set(int index, @ParametricNullness E element) { + public E set(@Mutable ForwardingList this, int index, @ParametricNullness E element) { return delegate().set(index, element); } @SideEffectFree @Override - public List subList(int fromIndex, int toIndex) { + public @PolyMutable List subList(@PolyMutable ForwardingList this, int fromIndex, int toIndex) { return delegate().subList(fromIndex, toIndex); } @Pure @Override - public boolean equals(@CheckForNull @UnknownSignedness Object object) { + public boolean equals(@Readonly ForwardingList this, @CheckForNull @UnknownSignedness @Readonly Object object) { return object == this || delegate().equals(object); } @Pure @Override - public int hashCode(@UnknownSignedness ForwardingList this) { + public int hashCode(@UnknownSignedness @Readonly ForwardingList this) { return delegate().hashCode(); } @@ -148,7 +153,7 @@ public int hashCode(@UnknownSignedness ForwardingList this) { * * @since 7.0 */ - protected boolean standardAdd(@ParametricNullness E element) { + protected boolean standardAdd(@Mutable ForwardingList this, @ParametricNullness E element) { add(size(), element); return true; } @@ -160,7 +165,7 @@ protected boolean standardAdd(@ParametricNullness E element) { * * @since 7.0 */ - protected boolean standardAddAll(int index, Iterable elements) { + protected boolean standardAddAll(@Mutable ForwardingList this, int index, Iterable elements) { return Lists.addAllImpl(this, index, elements); } @@ -171,7 +176,7 @@ protected boolean standardAddAll(int index, Iterable elements) { * * @since 7.0 */ - protected int standardIndexOf(@CheckForNull Object element) { + protected int standardIndexOf(@Readonly ForwardingList this, @CheckForNull @Readonly Object element) { return Lists.indexOfImpl(this, element); } @@ -182,7 +187,7 @@ protected int standardIndexOf(@CheckForNull Object element) { * * @since 7.0 */ - protected int standardLastIndexOf(@CheckForNull Object element) { + protected int standardLastIndexOf(@Readonly ForwardingList this, @CheckForNull @Readonly Object element) { return Lists.lastIndexOfImpl(this, element); } @@ -193,7 +198,7 @@ protected int standardLastIndexOf(@CheckForNull Object element) { * * @since 7.0 */ - protected Iterator standardIterator() { + protected Iterator standardIterator(@Readonly ForwardingList this) { return listIterator(); } @@ -204,7 +209,7 @@ protected Iterator standardIterator() { * * @since 7.0 */ - protected ListIterator standardListIterator() { + protected ListIterator standardListIterator(@Readonly ForwardingList this) { return listIterator(0); } @@ -217,7 +222,7 @@ protected ListIterator standardListIterator() { * @since 7.0 */ @Beta - protected ListIterator standardListIterator(int start) { + protected ListIterator standardListIterator(@Readonly ForwardingList this, int start) { return Lists.listIteratorImpl(this, start); } @@ -228,7 +233,7 @@ protected ListIterator standardListIterator(int start) { * @since 7.0 */ @Beta - protected List standardSubList(int fromIndex, int toIndex) { + protected @PolyMutable List standardSubList(@PolyMutable ForwardingList this, int fromIndex, int toIndex) { return Lists.subListImpl(this, fromIndex, toIndex); } @@ -240,7 +245,7 @@ protected List standardSubList(int fromIndex, int toIndex) { * @since 7.0 */ @Beta - protected boolean standardEquals(@CheckForNull Object object) { + protected boolean standardEquals(@Readonly ForwardingList this, @CheckForNull @Readonly Object object) { return Lists.equalsImpl(this, object); } @@ -252,7 +257,7 @@ protected boolean standardEquals(@CheckForNull Object object) { * @since 7.0 */ @Beta - protected int standardHashCode() { + protected int standardHashCode(@Readonly ForwardingList this) { return Lists.hashCodeImpl(this); } } diff --git a/guava/src/com/google/common/collect/ForwardingListIterator.java b/guava/src/com/google/common/collect/ForwardingListIterator.java index 49a312216361..30fdfd5ffed6 100644 --- a/guava/src/com/google/common/collect/ForwardingListIterator.java +++ b/guava/src/com/google/common/collect/ForwardingListIterator.java @@ -20,6 +20,9 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.ListIterator; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -40,7 +43,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingListIterator +@ReceiverDependentMutable +public abstract class ForwardingListIterator extends ForwardingIterator implements ListIterator { /** Constructor for use by subclasses. */ @@ -50,7 +54,7 @@ protected ForwardingListIterator() {} protected abstract ListIterator delegate(); @Override - public void add(@ParametricNullness E element) { + public void add(@Mutable ForwardingListIterator this, @ParametricNullness E element) { delegate().add(element); } @@ -79,7 +83,7 @@ public int previousIndex() { } @Override - public void set(@ParametricNullness E element) { + public void set(@Mutable ForwardingListIterator this, @ParametricNullness E element) { delegate().set(element); } } diff --git a/guava/src/com/google/common/collect/ForwardingListMultimap.java b/guava/src/com/google/common/collect/ForwardingListMultimap.java index 11779c0bb826..34a28517d5a3 100644 --- a/guava/src/com/google/common/collect/ForwardingListMultimap.java +++ b/guava/src/com/google/common/collect/ForwardingListMultimap.java @@ -21,6 +21,8 @@ import java.util.List; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; /** * A list multimap which forwards all its method calls to another list multimap. Subclasses should @@ -36,7 +38,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingListMultimap +public abstract class ForwardingListMultimap extends ForwardingMultimap implements ListMultimap { /** Constructor for use by subclasses. */ @@ -52,7 +54,7 @@ public List get(@ParametricNullness K key) { @CanIgnoreReturnValue @Override - public List removeAll(@CheckForNull Object key) { + public List removeAll(@CheckForNull @Readonly Object key) { return delegate().removeAll(key); } diff --git a/guava/src/com/google/common/collect/ForwardingMap.java b/guava/src/com/google/common/collect/ForwardingMap.java index 295f31dfd02d..41846863f31d 100644 --- a/guava/src/com/google/common/collect/ForwardingMap.java +++ b/guava/src/com/google/common/collect/ForwardingMap.java @@ -28,6 +28,11 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -61,10 +66,11 @@ * @author Louis Wasserman * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingMap +@ReceiverDependentMutable +public abstract class ForwardingMap extends ForwardingObject implements Map { // TODO(lowasser): identify places where thread safety is actually lost @@ -72,18 +78,18 @@ public abstract class ForwardingMap delegate(); + protected abstract @PolyMutable Map delegate(@PolyMutable ForwardingMap this); @Pure @Override @SuppressWarnings("index:overriding.return") - public @NonNegative int size() { + public @NonNegative int size(@Readonly ForwardingMap this) { return delegate().size(); } @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly ForwardingMap this) { return delegate().isEmpty(); } @@ -91,75 +97,75 @@ public boolean isEmpty() { @Override @SuppressWarnings("nullness:argument") // Suppressed due to annotations on remove in Java.Map @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@Mutable ForwardingMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return delegate().remove(key); } @Override - public void clear() { + public void clear(@Mutable ForwardingMap this) { delegate().clear(); } @Pure @Override @SuppressWarnings("nullness:argument") // Suppressed due to annotations on containsKey in Java.Map - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly ForwardingMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return delegate().containsKey(key); } @Pure @Override @SuppressWarnings("nullness:argument") // Suppressed due to annotations on containsValue in Java.Map - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly ForwardingMap this, @CheckForNull @UnknownSignedness @Readonly Object value) { return delegate().containsValue(value); } @Override @SuppressWarnings("nullness:argument") // Suppressed due to annotations on get in Java.Map @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@Readonly ForwardingMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return delegate().get(key); } @CanIgnoreReturnValue @Override @CheckForNull - public V put(@ParametricNullness K key, @ParametricNullness V value) { + public V put(@Mutable ForwardingMap this, @ParametricNullness K key, @ParametricNullness V value) { return delegate().put(key, value); } @Override - public void putAll(Map map) { + public void putAll(@Mutable ForwardingMap this, @Readonly Map map) { delegate().putAll(map); } @SideEffectFree @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable ForwardingMap this) { return delegate().keySet(); } @SideEffectFree @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable ForwardingMap this) { return delegate().values(); } @SideEffectFree @Override - public Set> entrySet() { + public @PolyMutable Set<@PolyMutable Entry<@KeyFor({"this"}) K, V>> entrySet(@PolyMutable ForwardingMap this) { return delegate().entrySet(); } @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@Readonly ForwardingMap this, @CheckForNull @Readonly Object object) { return object == this || delegate().equals(object); } @Pure @Override - public int hashCode(@UnknownSignedness ForwardingMap this) { + public int hashCode(@UnknownSignedness @Readonly ForwardingMap this) { return delegate().hashCode(); } @@ -170,7 +176,7 @@ public int hashCode(@UnknownSignedness ForwardingMap this) { * * @since 7.0 */ - protected void standardPutAll(Map map) { + protected void standardPutAll(@Mutable ForwardingMap this, @Readonly Map map) { Maps.putAllImpl(this, map); } @@ -186,7 +192,7 @@ protected void standardPutAll(Map map) { */ @Beta @CheckForNull - protected V standardRemove(@CheckForNull Object key) { + protected V standardRemove(@Mutable ForwardingMap this, @CheckForNull @Readonly Object key) { Iterator> entryIterator = entrySet().iterator(); while (entryIterator.hasNext()) { Entry entry = entryIterator.next(); @@ -206,7 +212,7 @@ protected V standardRemove(@CheckForNull Object key) { * * @since 7.0 */ - protected void standardClear() { + protected void standardClear(@Mutable ForwardingMap this) { Iterators.clear(entrySet().iterator()); } @@ -220,6 +226,7 @@ protected void standardClear() { * @since 10.0 */ @Beta + @ReceiverDependentMutable protected class StandardKeySet extends Maps.KeySet { /** Constructor for use by subclasses. */ public StandardKeySet() { @@ -235,7 +242,7 @@ public StandardKeySet() { * @since 7.0 */ @Beta - protected boolean standardContainsKey(@CheckForNull Object key) { + protected boolean standardContainsKey(@Readonly ForwardingMap this, @CheckForNull @Readonly Object key) { return Maps.containsKeyImpl(this, key); } @@ -249,6 +256,7 @@ protected boolean standardContainsKey(@CheckForNull Object key) { * @since 10.0 */ @Beta + @ReceiverDependentMutable protected class StandardValues extends Maps.Values { /** Constructor for use by subclasses. */ public StandardValues() { @@ -263,7 +271,7 @@ public StandardValues() { * * @since 7.0 */ - protected boolean standardContainsValue(@CheckForNull Object value) { + protected boolean standardContainsValue(@Readonly ForwardingMap this, @CheckForNull @Readonly Object value) { return Maps.containsValueImpl(this, value); } @@ -277,6 +285,7 @@ protected boolean standardContainsValue(@CheckForNull Object value) { * @since 10.0 */ @Beta + @ReceiverDependentMutable protected abstract class StandardEntrySet extends Maps.EntrySet { /** Constructor for use by subclasses. */ public StandardEntrySet() {} @@ -294,7 +303,7 @@ Map map() { * * @since 7.0 */ - protected boolean standardIsEmpty() { + protected boolean standardIsEmpty(@Readonly ForwardingMap this) { return !entrySet().iterator().hasNext(); } @@ -305,7 +314,7 @@ protected boolean standardIsEmpty() { * * @since 7.0 */ - protected boolean standardEquals(@CheckForNull Object object) { + protected boolean standardEquals(@Readonly ForwardingMap this, @CheckForNull @Readonly Object object) { return Maps.equalsImpl(this, object); } @@ -316,7 +325,7 @@ protected boolean standardEquals(@CheckForNull Object object) { * * @since 7.0 */ - protected int standardHashCode() { + protected int standardHashCode(@Readonly ForwardingMap this) { return Sets.hashCodeImpl(entrySet()); } @@ -327,7 +336,7 @@ protected int standardHashCode() { * * @since 7.0 */ - protected String standardToString() { + protected String standardToString(@Readonly ForwardingMap this) { return Maps.toStringImpl(this); } } diff --git a/guava/src/com/google/common/collect/ForwardingMapEntry.java b/guava/src/com/google/common/collect/ForwardingMapEntry.java index a8fec1c83229..84e53bb2245c 100644 --- a/guava/src/com/google/common/collect/ForwardingMapEntry.java +++ b/guava/src/com/google/common/collect/ForwardingMapEntry.java @@ -24,6 +24,11 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -50,10 +55,11 @@ * @author Louis Wasserman * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingMapEntry +@ReceiverDependentMutable +public abstract class ForwardingMapEntry extends ForwardingObject implements Map.Entry { // TODO(lowasser): identify places where thread safety is actually lost @@ -61,37 +67,37 @@ public abstract class ForwardingMapEntry delegate(); + protected abstract @PolyMutable Entry delegate(@PolyMutable ForwardingMapEntry this); @Pure @Override @ParametricNullness - public K getKey() { + public K getKey(@Readonly ForwardingMapEntry this) { return delegate().getKey(); } @Pure @Override @ParametricNullness - public V getValue() { + public V getValue(@Readonly ForwardingMapEntry this) { return delegate().getValue(); } @Override @ParametricNullness - public V setValue(@ParametricNullness V value) { + public V setValue(@Mutable ForwardingMapEntry this, @ParametricNullness V value) { return delegate().setValue(value); } @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@Readonly ForwardingMapEntry this, @CheckForNull @Readonly Object object) { return delegate().equals(object); } @Pure @Override - public int hashCode(@UnknownSignedness ForwardingMapEntry this) { + public int hashCode(@UnknownSignedness @Readonly ForwardingMapEntry this) { return delegate().hashCode(); } @@ -102,7 +108,7 @@ public int hashCode(@UnknownSignedness ForwardingMapEntry this) { * * @since 7.0 */ - protected boolean standardEquals(@CheckForNull Object object) { + protected boolean standardEquals(@Readonly ForwardingMapEntry this, @CheckForNull @Readonly Object object) { if (object instanceof Entry) { Entry that = (Entry) object; return Objects.equal(this.getKey(), that.getKey()) @@ -118,7 +124,7 @@ protected boolean standardEquals(@CheckForNull Object object) { * * @since 7.0 */ - protected int standardHashCode() { + protected int standardHashCode(@Readonly ForwardingMapEntry this) { K k = getKey(); V v = getValue(); return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode()); @@ -132,7 +138,7 @@ protected int standardHashCode() { * @since 7.0 */ @Beta - protected String standardToString() { + protected String standardToString(@Readonly ForwardingMapEntry this) { return getKey() + "=" + getValue(); } } diff --git a/guava/src/com/google/common/collect/ForwardingMultimap.java b/guava/src/com/google/common/collect/ForwardingMultimap.java index 735ff22e4131..f6a9f43a1402 100644 --- a/guava/src/com/google/common/collect/ForwardingMultimap.java +++ b/guava/src/com/google/common/collect/ForwardingMultimap.java @@ -24,6 +24,11 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -41,131 +46,132 @@ * @author Robert Konigsberg * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingMultimap +@ReceiverDependentMutable +public abstract class ForwardingMultimap extends ForwardingObject implements Multimap { /** Constructor for use by subclasses. */ protected ForwardingMultimap() {} @Override - protected abstract Multimap delegate(); + protected abstract @PolyMutable Multimap delegate(@PolyMutable ForwardingMultimap this); @Override - public Map> asMap() { + public @PolyMutable Map> asMap(@PolyMutable ForwardingMultimap this) { return delegate().asMap(); } @Override - public void clear() { + public void clear(@Mutable ForwardingMultimap this) { delegate().clear(); } @Pure @Override - public boolean containsEntry(@CheckForNull Object key, @CheckForNull Object value) { + public boolean containsEntry(@Readonly ForwardingMultimap this, @CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { return delegate().containsEntry(key, value); } @Pure @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly ForwardingMultimap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return delegate().containsKey(key); } @Pure @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly ForwardingMultimap this, @CheckForNull @UnknownSignedness @Readonly Object value) { return delegate().containsValue(value); } @SideEffectFree @Override - public Collection> entries() { + public @PolyMutable Collection<@PolyMutable Entry> entries(@PolyMutable ForwardingMultimap this) { return delegate().entries(); } @Override - public Collection get(@ParametricNullness K key) { + public @PolyMutable Collection get(@PolyMutable ForwardingMultimap this, @ParametricNullness K key) { return delegate().get(key); } @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly ForwardingMultimap this) { return delegate().isEmpty(); } @Override - public Multiset keys() { + public @PolyMutable Multiset keys(@PolyMutable ForwardingMultimap this) { return delegate().keys(); } @SideEffectFree @Override - public Set keySet() { + public @PolyMutable Set keySet(@PolyMutable ForwardingMultimap this) { return delegate().keySet(); } @CanIgnoreReturnValue @Override - public boolean put(@ParametricNullness K key, @ParametricNullness V value) { + public boolean put(@Mutable ForwardingMultimap this, @ParametricNullness K key, @ParametricNullness V value) { return delegate().put(key, value); } @CanIgnoreReturnValue @Override - public boolean putAll(@ParametricNullness K key, Iterable values) { + public boolean putAll(@Mutable ForwardingMultimap this, @ParametricNullness K key, Iterable values) { return delegate().putAll(key, values); } @CanIgnoreReturnValue @Override - public boolean putAll(Multimap multimap) { + public boolean putAll(@Mutable ForwardingMultimap this, @Readonly Multimap multimap) { return delegate().putAll(multimap); } @CanIgnoreReturnValue @Override - public boolean remove(@CheckForNull Object key, @CheckForNull Object value) { + public boolean remove(@Mutable ForwardingMultimap this, @CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { return delegate().remove(key, value); } @CanIgnoreReturnValue @Override - public Collection removeAll(@CheckForNull Object key) { + public @Readonly Collection removeAll(@Mutable ForwardingMultimap this, @CheckForNull @Readonly Object key) { return delegate().removeAll(key); } @CanIgnoreReturnValue @Override - public Collection replaceValues(@ParametricNullness K key, Iterable values) { + public @Readonly Collection replaceValues(@Mutable ForwardingMultimap this, @ParametricNullness K key, Iterable values) { return delegate().replaceValues(key, values); } @Pure @Override - public int size() { + public int size(@Readonly ForwardingMultimap this) { return delegate().size(); } @SideEffectFree @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable ForwardingMultimap this) { return delegate().values(); } @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@Readonly ForwardingMultimap this, @CheckForNull @Readonly Object object) { return object == this || delegate().equals(object); } @Pure @Override - public int hashCode(@UnknownSignedness ForwardingMultimap this) { + public int hashCode(@UnknownSignedness @Readonly ForwardingMultimap this) { return delegate().hashCode(); } } diff --git a/guava/src/com/google/common/collect/ForwardingMultiset.java b/guava/src/com/google/common/collect/ForwardingMultiset.java index 2a3191724ca3..0854f85a5609 100644 --- a/guava/src/com/google/common/collect/ForwardingMultiset.java +++ b/guava/src/com/google/common/collect/ForwardingMultiset.java @@ -26,6 +26,9 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -53,68 +56,69 @@ * @author Louis Wasserman * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingMultiset extends ForwardingCollection +@ReceiverDependentMutable +public abstract class ForwardingMultiset extends ForwardingCollection implements Multiset { /** Constructor for use by subclasses. */ protected ForwardingMultiset() {} @Override - protected abstract Multiset delegate(); + protected abstract @PolyMutable Multiset delegate(@PolyMutable ForwardingMultiset this); @Override - public @NonNegative int count(@CheckForNull @UnknownSignedness Object element) { + public @NonNegative int count(@CheckForNull @UnknownSignedness @Readonly Object element) { return delegate().count(element); } @CanIgnoreReturnValue @Override - public int add(@ParametricNullness E element, int occurrences) { + public int add(@Mutable ForwardingMultiset this, @ParametricNullness E element, int occurrences) { return delegate().add(element, occurrences); } @CanIgnoreReturnValue @Override - public int remove(@CheckForNull Object element, int occurrences) { + public int remove(@Mutable ForwardingMultiset this, @CheckForNull Object element, int occurrences) { return delegate().remove(element, occurrences); } @SideEffectFree @Override - public Set elementSet() { + public @PolyMutable Set elementSet(@PolyMutable ForwardingMultiset this) { return delegate().elementSet(); } @SideEffectFree @Override - public Set> entrySet() { + public @PolyMutable Set<@PolyMutable Entry> entrySet(@PolyMutable ForwardingMultiset this) { return delegate().entrySet(); } @Pure @Override - public boolean equals(@CheckForNull @UnknownSignedness Object object) { + public boolean equals(@Readonly ForwardingMultiset this, @CheckForNull @UnknownSignedness @Readonly Object object) { return object == this || delegate().equals(object); } @Pure @Override - public int hashCode(@UnknownSignedness ForwardingMultiset this) { + public int hashCode(@UnknownSignedness @Readonly ForwardingMultiset this) { return delegate().hashCode(); } @CanIgnoreReturnValue @Override - public int setCount(@ParametricNullness E element, int count) { + public int setCount(@Mutable ForwardingMultiset this, @ParametricNullness E element, int count) { return delegate().setCount(element, count); } @CanIgnoreReturnValue @Override - public boolean setCount(@ParametricNullness E element, int oldCount, int newCount) { + public boolean setCount(@Mutable ForwardingMultiset this, @ParametricNullness E element, int oldCount, int newCount) { return delegate().setCount(element, oldCount, newCount); } @@ -125,7 +129,7 @@ public boolean setCount(@ParametricNullness E element, int oldCount, int newCoun * @since 7.0 */ @Override - protected boolean standardContains(@CheckForNull Object object) { + protected boolean standardContains(@Readonly ForwardingMultiset this, @CheckForNull @Readonly Object object) { return count(object) > 0; } @@ -137,7 +141,7 @@ protected boolean standardContains(@CheckForNull Object object) { * @since 7.0 */ @Override - protected void standardClear() { + protected void standardClear(@Mutable ForwardingMultiset this) { Iterators.clear(entrySet().iterator()); } @@ -149,7 +153,7 @@ protected void standardClear() { * @since 7.0 */ @Beta - protected int standardCount(@CheckForNull Object object) { + protected int standardCount(@Readonly ForwardingMultiset this, @CheckForNull @Readonly Object object) { for (Entry entry : this.entrySet()) { if (Objects.equal(entry.getElement(), object)) { return entry.getCount(); @@ -165,7 +169,7 @@ protected int standardCount(@CheckForNull Object object) { * * @since 7.0 */ - protected boolean standardAdd(@ParametricNullness E element) { + protected boolean standardAdd(@Mutable ForwardingMultiset this, @ParametricNullness E element) { add(element, 1); return true; } @@ -179,7 +183,7 @@ protected boolean standardAdd(@ParametricNullness E element) { */ @Beta @Override - protected boolean standardAddAll(Collection elementsToAdd) { + protected boolean standardAddAll(@Mutable ForwardingMultiset this, @Readonly Collection elementsToAdd) { return Multisets.addAllImpl(this, elementsToAdd); } @@ -191,7 +195,7 @@ protected boolean standardAddAll(Collection elementsToAdd) { * @since 7.0 */ @Override - protected boolean standardRemove(@CheckForNull Object element) { + protected boolean standardRemove(@Mutable ForwardingMultiset this, @CheckForNull @Readonly Object element) { return remove(element, 1) > 0; } @@ -203,7 +207,7 @@ protected boolean standardRemove(@CheckForNull Object element) { * @since 7.0 */ @Override - protected boolean standardRemoveAll(Collection elementsToRemove) { + protected boolean standardRemoveAll(@Mutable ForwardingMultiset this, @Readonly Collection elementsToRemove) { return Multisets.removeAllImpl(this, elementsToRemove); } @@ -215,7 +219,7 @@ protected boolean standardRemoveAll(Collection elementsToRemove) { * @since 7.0 */ @Override - protected boolean standardRetainAll(Collection elementsToRetain) { + protected boolean standardRetainAll(@Mutable ForwardingMultiset this, @Readonly Collection elementsToRetain) { return Multisets.retainAllImpl(this, elementsToRetain); } @@ -227,7 +231,7 @@ protected boolean standardRetainAll(Collection elementsToRetain) { * * @since 7.0 */ - protected int standardSetCount(@ParametricNullness E element, int count) { + protected int standardSetCount(@Mutable ForwardingMultiset this, @ParametricNullness E element, int count) { return Multisets.setCountImpl(this, element, count); } @@ -238,7 +242,7 @@ protected int standardSetCount(@ParametricNullness E element, int count) { * * @since 7.0 */ - protected boolean standardSetCount(@ParametricNullness E element, int oldCount, int newCount) { + protected boolean standardSetCount(@Mutable ForwardingMultiset this, @ParametricNullness E element, int oldCount, int newCount) { return Multisets.setCountImpl(this, element, oldCount, newCount); } @@ -254,17 +258,18 @@ protected boolean standardSetCount(@ParametricNullness E element, int oldCount, * @since 10.0 */ @Beta + @ReceiverDependentMutable protected class StandardElementSet extends Multisets.ElementSet { /** Constructor for use by subclasses. */ public StandardElementSet() {} @Override - Multiset multiset() { + Multiset multiset(@PolyMutable ForwardingMultiset.StandardElementSet this) { return ForwardingMultiset.this; } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly StandardElementSet this) { return Multisets.elementIterator(multiset().entrySet().iterator()); } } @@ -276,7 +281,7 @@ public Iterator iterator() { * * @since 7.0 */ - protected Iterator standardIterator() { + protected Iterator standardIterator(@Readonly ForwardingMultiset this) { return Multisets.iteratorImpl(this); } @@ -287,7 +292,7 @@ protected Iterator standardIterator() { * * @since 7.0 */ - protected int standardSize() { + protected int standardSize(@Readonly ForwardingMultiset this) { return Multisets.linearTimeSizeImpl(this); } @@ -298,7 +303,7 @@ protected int standardSize() { * * @since 7.0 */ - protected boolean standardEquals(@CheckForNull Object object) { + protected boolean standardEquals(@Readonly ForwardingMultiset this, @CheckForNull @Readonly Object object) { return Multisets.equalsImpl(this, object); } @@ -309,7 +314,7 @@ protected boolean standardEquals(@CheckForNull Object object) { * * @since 7.0 */ - protected int standardHashCode() { + protected int standardHashCode(@Readonly ForwardingMultiset this) { return entrySet().hashCode(); } @@ -321,7 +326,7 @@ protected int standardHashCode() { * @since 7.0 */ @Override - protected String standardToString() { + protected String standardToString(@Readonly ForwardingMultiset this) { return entrySet().toString(); } } diff --git a/guava/src/com/google/common/collect/ForwardingNavigableMap.java b/guava/src/com/google/common/collect/ForwardingNavigableMap.java index f54ac5bf9554..e0839a391d85 100644 --- a/guava/src/com/google/common/collect/ForwardingNavigableMap.java +++ b/guava/src/com/google/common/collect/ForwardingNavigableMap.java @@ -29,6 +29,12 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A navigable map which forwards all its method calls to another navigable map. Subclasses should @@ -56,20 +62,22 @@ * @author Louis Wasserman * @since 12.0 */ +@AnnotatedFor("pico") @GwtIncompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingNavigableMap +@ReceiverDependentMutable +public abstract class ForwardingNavigableMap extends ForwardingSortedMap implements NavigableMap { /** Constructor for use by subclasses. */ protected ForwardingNavigableMap() {} @Override - protected abstract NavigableMap delegate(); + protected abstract @PolyMutable NavigableMap delegate(@PolyMutable ForwardingNavigableMap this); @Override @CheckForNull - public Entry lowerEntry(@ParametricNullness K key) { + public Entry lowerEntry(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return delegate().lowerEntry(key); } @@ -79,13 +87,13 @@ public Entry lowerEntry(@ParametricNullness K key) { * lowerEntry} to forward to this implementation. */ @CheckForNull - protected Entry standardLowerEntry(@ParametricNullness K key) { + protected Entry standardLowerEntry(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return headMap(key, false).lastEntry(); } @Override @CheckForNull - public K lowerKey(@ParametricNullness K key) { + public K lowerKey(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return delegate().lowerKey(key); } @@ -95,13 +103,13 @@ public K lowerKey(@ParametricNullness K key) { * implementation. */ @CheckForNull - protected K standardLowerKey(@ParametricNullness K key) { + protected K standardLowerKey(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return keyOrNull(lowerEntry(key)); } @Override @CheckForNull - public Entry floorEntry(@ParametricNullness K key) { + public Entry floorEntry(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return delegate().floorEntry(key); } @@ -111,13 +119,13 @@ public Entry floorEntry(@ParametricNullness K key) { * floorEntry} to forward to this implementation. */ @CheckForNull - protected Entry standardFloorEntry(@ParametricNullness K key) { + protected Entry standardFloorEntry(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return headMap(key, true).lastEntry(); } @Override @CheckForNull - public K floorKey(@ParametricNullness K key) { + public K floorKey(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return delegate().floorKey(key); } @@ -127,13 +135,13 @@ public K floorKey(@ParametricNullness K key) { * implementation. */ @CheckForNull - protected K standardFloorKey(@ParametricNullness K key) { + protected K standardFloorKey(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return keyOrNull(floorEntry(key)); } @Override @CheckForNull - public Entry ceilingEntry(@ParametricNullness K key) { + public Entry ceilingEntry(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return delegate().ceilingEntry(key); } @@ -143,13 +151,13 @@ public Entry ceilingEntry(@ParametricNullness K key) { * ceilingEntry} to forward to this implementation. */ @CheckForNull - protected Entry standardCeilingEntry(@ParametricNullness K key) { + protected Entry standardCeilingEntry(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return tailMap(key, true).firstEntry(); } @Override @CheckForNull - public K ceilingKey(@ParametricNullness K key) { + public K ceilingKey(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return delegate().ceilingKey(key); } @@ -159,13 +167,13 @@ public K ceilingKey(@ParametricNullness K key) { * implementation. */ @CheckForNull - protected K standardCeilingKey(@ParametricNullness K key) { + protected K standardCeilingKey(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return keyOrNull(ceilingEntry(key)); } @Override @CheckForNull - public Entry higherEntry(@ParametricNullness K key) { + public Entry higherEntry(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return delegate().higherEntry(key); } @@ -175,13 +183,13 @@ public Entry higherEntry(@ParametricNullness K key) { * higherEntry} to forward to this implementation. */ @CheckForNull - protected Entry standardHigherEntry(@ParametricNullness K key) { + protected Entry standardHigherEntry(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return tailMap(key, false).firstEntry(); } @Override @CheckForNull - public K higherKey(@ParametricNullness K key) { + public K higherKey(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return delegate().higherKey(key); } @@ -191,13 +199,13 @@ public K higherKey(@ParametricNullness K key) { * implementation. */ @CheckForNull - protected K standardHigherKey(@ParametricNullness K key) { + protected K standardHigherKey(@Readonly ForwardingNavigableMap this, @ParametricNullness K key) { return keyOrNull(higherEntry(key)); } @Override @CheckForNull - public Entry firstEntry() { + public Entry firstEntry(@Readonly ForwardingNavigableMap this) { return delegate().firstEntry(); } @@ -207,7 +215,7 @@ public Entry firstEntry() { * forward to this implementation. */ @CheckForNull - protected Entry standardFirstEntry() { + protected Entry standardFirstEntry(@Readonly ForwardingNavigableMap this) { return Iterables.getFirst(entrySet(), null); } @@ -216,7 +224,7 @@ protected Entry standardFirstEntry() { * {@code firstEntry}, you may wish to override {@code firstKey} to forward to this * implementation. */ - protected K standardFirstKey() { + protected K standardFirstKey(@Readonly ForwardingNavigableMap this) { Entry entry = firstEntry(); if (entry == null) { throw new NoSuchElementException(); @@ -227,7 +235,7 @@ protected K standardFirstKey() { @Override @CheckForNull - public Entry lastEntry() { + public Entry lastEntry(@Readonly ForwardingNavigableMap this) { return delegate().lastEntry(); } @@ -237,7 +245,7 @@ public Entry lastEntry() { * override {@code lastEntry} to forward to this implementation. */ @CheckForNull - protected Entry standardLastEntry() { + protected Entry standardLastEntry(@Readonly ForwardingNavigableMap this) { return Iterables.getFirst(descendingMap().entrySet(), null); } @@ -245,7 +253,7 @@ protected Entry standardLastEntry() { * A sensible definition of {@link #lastKey} in terms of {@code lastEntry}. If you override {@code * lastEntry}, you may wish to override {@code lastKey} to forward to this implementation. */ - protected K standardLastKey() { + protected K standardLastKey(@Readonly ForwardingNavigableMap this) { Entry entry = lastEntry(); if (entry == null) { throw new NoSuchElementException(); @@ -256,7 +264,7 @@ protected K standardLastKey() { @Override @CheckForNull - public Entry pollFirstEntry() { + public Entry pollFirstEntry(@Mutable ForwardingNavigableMap this) { return delegate().pollFirstEntry(); } @@ -266,13 +274,13 @@ public Entry pollFirstEntry() { * forward to this implementation. */ @CheckForNull - protected Entry standardPollFirstEntry() { + protected Entry standardPollFirstEntry(@Mutable ForwardingNavigableMap this) { return Iterators.pollNext(entrySet().iterator()); } @Override @CheckForNull - public Entry pollLastEntry() { + public Entry pollLastEntry(@Mutable ForwardingNavigableMap this) { return delegate().pollLastEntry(); } @@ -282,12 +290,12 @@ public Entry pollLastEntry() { * override {@code pollFirstEntry} to forward to this implementation. */ @CheckForNull - protected Entry standardPollLastEntry() { + protected Entry standardPollLastEntry(@Mutable ForwardingNavigableMap this) { return Iterators.pollNext(descendingMap().entrySet().iterator()); } @Override - public NavigableMap descendingMap() { + public @PolyMutable NavigableMap descendingMap(@PolyMutable ForwardingNavigableMap this) { return delegate().descendingMap(); } @@ -303,23 +311,24 @@ public NavigableMap descendingMap() { * @since 12.0 */ @Beta + @ReceiverDependentMutable protected class StandardDescendingMap extends Maps.DescendingMap { /** Constructor for use by subclasses. */ public StandardDescendingMap() {} @Override - NavigableMap forward() { + @PolyMutable NavigableMap forward(@PolyMutable StandardDescendingMap this) { return ForwardingNavigableMap.this; } @Override - public void replaceAll(BiFunction function) { + public void replaceAll(@Mutable StandardDescendingMap this, BiFunction function) { forward().replaceAll(function); } @Override - protected Iterator> entryIterator() { - return new Iterator>() { + protected Iterator<@PolyMutable Entry> entryIterator(@PolyMutable StandardDescendingMap this) { + return new Iterator<@PolyMutable Entry>() { @CheckForNull private Entry toRemove = null; @CheckForNull private Entry nextOrNull = forward().lastEntry(); @@ -354,7 +363,7 @@ public void remove() { } @Override - public NavigableSet<@KeyFor({"this"}) K> navigableKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> navigableKeySet(@PolyMutable ForwardingNavigableMap this) { return delegate().navigableKeySet(); } @@ -367,6 +376,7 @@ public void remove() { * @since 12.0 */ @Beta + @ReceiverDependentMutable protected class StandardNavigableKeySet extends Maps.NavigableKeySet { /** Constructor for use by subclasses. */ public StandardNavigableKeySet() { @@ -375,7 +385,7 @@ public StandardNavigableKeySet() { } @Override - public NavigableSet<@KeyFor({"this"}) K> descendingKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> descendingKeySet(@PolyMutable ForwardingNavigableMap this) { return delegate().descendingKeySet(); } @@ -387,7 +397,7 @@ public StandardNavigableKeySet() { * implementation. */ @Beta - protected NavigableSet standardDescendingKeySet() { + protected @PolyMutable NavigableSet standardDescendingKeySet(@PolyMutable ForwardingNavigableMap this) { return descendingMap().navigableKeySet(); } @@ -397,13 +407,15 @@ protected NavigableSet standardDescendingKeySet() { * wish to override {@code subMap} to forward to this implementation. */ @Override - protected SortedMap standardSubMap( + protected @PolyMutable SortedMap standardSubMap( + @PolyMutable ForwardingNavigableMap this, @ParametricNullness K fromKey, @ParametricNullness K toKey) { return subMap(fromKey, true, toKey, false); } @Override - public NavigableMap subMap( + public @PolyMutable NavigableMap subMap( + @PolyMutable ForwardingNavigableMap this, @ParametricNullness K fromKey, boolean fromInclusive, @ParametricNullness K toKey, @@ -412,12 +424,12 @@ public NavigableMap subMap( } @Override - public NavigableMap headMap(@ParametricNullness K toKey, boolean inclusive) { + public @PolyMutable NavigableMap headMap(@PolyMutable ForwardingNavigableMap this, @ParametricNullness K toKey, boolean inclusive) { return delegate().headMap(toKey, inclusive); } @Override - public NavigableMap tailMap(@ParametricNullness K fromKey, boolean inclusive) { + public @PolyMutable NavigableMap tailMap(@PolyMutable ForwardingNavigableMap this, @ParametricNullness K fromKey, boolean inclusive) { return delegate().tailMap(fromKey, inclusive); } @@ -426,7 +438,7 @@ public NavigableMap tailMap(@ParametricNullness K fromKey, boolean inclusi * boolean)}. If you override {@code headMap(K, boolean)}, you may wish to override {@code * headMap} to forward to this implementation. */ - protected SortedMap standardHeadMap(@ParametricNullness K toKey) { + protected @PolyMutable SortedMap standardHeadMap(@PolyMutable ForwardingNavigableMap this, @ParametricNullness K toKey) { return headMap(toKey, false); } @@ -435,7 +447,7 @@ protected SortedMap standardHeadMap(@ParametricNullness K toKey) { * boolean)}. If you override {@code tailMap(K, boolean)}, you may wish to override {@code * tailMap} to forward to this implementation. */ - protected SortedMap standardTailMap(@ParametricNullness K fromKey) { + protected @PolyMutable SortedMap standardTailMap(@PolyMutable ForwardingNavigableMap this, @ParametricNullness K fromKey) { return tailMap(fromKey, true); } } diff --git a/guava/src/com/google/common/collect/ForwardingNavigableSet.java b/guava/src/com/google/common/collect/ForwardingNavigableSet.java index 6822aa87d4fc..ff6099cad8a3 100644 --- a/guava/src/com/google/common/collect/ForwardingNavigableSet.java +++ b/guava/src/com/google/common/collect/ForwardingNavigableSet.java @@ -23,6 +23,8 @@ import java.util.SortedSet; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * A navigable set which forwards all its method calls to another navigable set. Subclasses should @@ -52,7 +54,8 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingNavigableSet +@ReceiverDependentMutable +public abstract class ForwardingNavigableSet extends ForwardingSortedSet implements NavigableSet { /** Constructor for use by subclasses. */ @@ -182,6 +185,7 @@ public NavigableSet descendingSet() { * @since 12.0 */ @Beta + @ReceiverDependentMutable protected class StandardDescendingSet extends Sets.DescendingSet { /** Constructor for use by subclasses. */ public StandardDescendingSet() { diff --git a/guava/src/com/google/common/collect/ForwardingObject.java b/guava/src/com/google/common/collect/ForwardingObject.java index 6a55a8541134..581e159e3b5a 100644 --- a/guava/src/com/google/common/collect/ForwardingObject.java +++ b/guava/src/com/google/common/collect/ForwardingObject.java @@ -18,6 +18,9 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -45,9 +48,10 @@ * @author Mike Bostock * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault +@ReceiverDependentMutable public abstract class ForwardingObject { /** Constructor for use by subclasses. */ @@ -59,12 +63,12 @@ protected ForwardingObject() {} * such as {@link ForwardingSet#delegate}. Concrete subclasses override this method to supply the * instance being decorated. */ - protected abstract Object delegate(); + protected abstract @PolyMutable Object delegate(@PolyMutable ForwardingObject this); /** Returns the string representation generated by the delegate's {@code toString} method. */ @Pure @Override - public String toString() { + public String toString(@Readonly ForwardingObject this) { return delegate().toString(); } diff --git a/guava/src/com/google/common/collect/ForwardingQueue.java b/guava/src/com/google/common/collect/ForwardingQueue.java index d76581f5f336..ea5e97b1ff42 100644 --- a/guava/src/com/google/common/collect/ForwardingQueue.java +++ b/guava/src/com/google/common/collect/ForwardingQueue.java @@ -22,6 +22,8 @@ import java.util.Queue; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -49,7 +51,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingQueue extends ForwardingCollection +@ReceiverDependentMutable +public abstract class ForwardingQueue extends ForwardingCollection implements Queue { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/collect/ForwardingSet.java b/guava/src/com/google/common/collect/ForwardingSet.java index 16d0e135ff86..564810bc4008 100644 --- a/guava/src/com/google/common/collect/ForwardingSet.java +++ b/guava/src/com/google/common/collect/ForwardingSet.java @@ -23,6 +23,9 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -52,7 +55,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingSet extends ForwardingCollection +@ReceiverDependentMutable +public abstract class ForwardingSet extends ForwardingCollection implements Set { // TODO(lowasser): identify places where thread safety is actually lost @@ -60,17 +64,18 @@ public abstract class ForwardingSet extends Forwardi protected ForwardingSet() {} @Override - protected abstract Set delegate(); + // TODO(aosen): If I make poly on both, how to avoid rep exposure and type confusion? + protected abstract Set delegate(@Readonly ForwardingSet this); @Pure @Override - public boolean equals(@CheckForNull @UnknownSignedness Object object) { + public boolean equals(@Readonly ForwardingSet this, @CheckForNull @UnknownSignedness @Readonly Object object) { return object == this || delegate().equals(object); } @Pure @Override - public int hashCode(@UnknownSignedness ForwardingSet this) { + public int hashCode(@UnknownSignedness @Readonly ForwardingSet this) { return delegate().hashCode(); } @@ -82,7 +87,7 @@ public int hashCode(@UnknownSignedness ForwardingSet this) { * @since 7.0 (this version overrides the {@code ForwardingCollection} version as of 12.0) */ @Override - protected boolean standardRemoveAll(Collection collection) { + protected boolean standardRemoveAll(@Mutable ForwardingSet this, @Readonly Collection collection) { return Sets.removeAllImpl(this, checkNotNull(collection)); // for GWT } @@ -93,7 +98,7 @@ protected boolean standardRemoveAll(Collection collection) { * * @since 7.0 */ - protected boolean standardEquals(@CheckForNull Object object) { + protected boolean standardEquals(@Readonly ForwardingSet this, @CheckForNull @Readonly Object object) { return Sets.equalsImpl(this, object); } @@ -103,7 +108,7 @@ protected boolean standardEquals(@CheckForNull Object object) { * * @since 7.0 */ - protected int standardHashCode() { + protected int standardHashCode(@Readonly ForwardingSet this) { return Sets.hashCodeImpl(this); } } diff --git a/guava/src/com/google/common/collect/ForwardingSetMultimap.java b/guava/src/com/google/common/collect/ForwardingSetMultimap.java index 5077c6803cf9..7bd2fe5456d9 100644 --- a/guava/src/com/google/common/collect/ForwardingSetMultimap.java +++ b/guava/src/com/google/common/collect/ForwardingSetMultimap.java @@ -22,6 +22,9 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * A set multimap which forwards all its method calls to another set multimap. Subclasses should @@ -37,7 +40,8 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingSetMultimap +@ReceiverDependentMutable +public abstract class ForwardingSetMultimap extends ForwardingMultimap implements SetMultimap { @Override @@ -55,7 +59,7 @@ public Set get(@ParametricNullness K key) { @CanIgnoreReturnValue @Override - public Set removeAll(@CheckForNull Object key) { + public Set removeAll(@CheckForNull @Readonly Object key) { return delegate().removeAll(key); } diff --git a/guava/src/com/google/common/collect/ForwardingSortedMap.java b/guava/src/com/google/common/collect/ForwardingSortedMap.java index 2d1b3eaa77ac..01b28cf8dff7 100644 --- a/guava/src/com/google/common/collect/ForwardingSortedMap.java +++ b/guava/src/com/google/common/collect/ForwardingSortedMap.java @@ -26,6 +26,9 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; @@ -54,10 +57,11 @@ * @author Louis Wasserman * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingSortedMap +@ReceiverDependentMutable +public abstract class ForwardingSortedMap extends ForwardingMap implements SortedMap { // TODO(lowasser): identify places where thread safety is actually lost @@ -65,39 +69,39 @@ public abstract class ForwardingSortedMap delegate(); + protected abstract @PolyMutable SortedMap delegate(@PolyMutable ForwardingSortedMap this); @SideEffectFree @Override @CheckForNull - public Comparator comparator() { + public Comparator comparator(@Readonly ForwardingSortedMap this) { return delegate().comparator(); } @Override @ParametricNullness - public @KeyFor("this") K firstKey() { + public @KeyFor("this") K firstKey(@Readonly ForwardingSortedMap this) { return delegate().firstKey(); } @Override - public SortedMap headMap(@ParametricNullness K toKey) { + public @PolyMutable SortedMap headMap(@PolyMutable ForwardingSortedMap this, @ParametricNullness K toKey) { return delegate().headMap(toKey); } @Override @ParametricNullness - public @KeyFor("this") K lastKey() { + public @KeyFor("this") K lastKey(@Readonly ForwardingSortedMap this) { return delegate().lastKey(); } @Override - public SortedMap subMap(@ParametricNullness K fromKey, @ParametricNullness K toKey) { + public @PolyMutable SortedMap subMap(@PolyMutable ForwardingSortedMap this, @ParametricNullness K fromKey, @ParametricNullness K toKey) { return delegate().subMap(fromKey, toKey); } @Override - public SortedMap tailMap(@ParametricNullness K fromKey) { + public @PolyMutable SortedMap tailMap(@PolyMutable ForwardingSortedMap this, @ParametricNullness K fromKey) { return delegate().tailMap(fromKey); } @@ -109,6 +113,7 @@ public SortedMap tailMap(@ParametricNullness K fromKey) { * @since 15.0 */ @Beta + @ReceiverDependentMutable protected class StandardKeySet extends Maps.SortedKeySet { /** Constructor for use by subclasses. */ public StandardKeySet() { @@ -119,11 +124,11 @@ public StandardKeySet() { // unsafe, but worst case is a CCE or NPE is thrown, which callers will be expecting @SuppressWarnings({"unchecked", "nullness"}) static int unsafeCompare( - @CheckForNull Comparator comparator, @CheckForNull Object o1, @CheckForNull Object o2) { + @CheckForNull Comparator comparator, @CheckForNull @Readonly Object o1, @CheckForNull @Readonly Object o2) { if (comparator == null) { - return ((Comparable<@Nullable Object>) o1).compareTo(o2); + return ((Comparable<@Nullable @Readonly Object>) o1).compareTo(o2); } else { - return ((Comparator<@Nullable Object>) comparator).compare(o1, o2); + return ((Comparator<@Nullable @Readonly Object>) comparator).compare(o1, o2); } } @@ -136,11 +141,11 @@ static int unsafeCompare( */ @Override @Beta - protected boolean standardContainsKey(@CheckForNull Object key) { + protected boolean standardContainsKey(@Readonly ForwardingSortedMap this, @CheckForNull @Readonly Object key) { try { // any CCE or NPE will be caught @SuppressWarnings({"unchecked", "nullness"}) - SortedMap<@Nullable Object, V> self = (SortedMap<@Nullable Object, V>) this; + SortedMap<@Nullable @Immutable Object, V> self = (@Readonly SortedMap<@Nullable @Immutable Object, V>) this; Object ceilingKey = self.tailMap(key).firstKey(); return unsafeCompare(comparator(), ceilingKey, key) == 0; } catch (ClassCastException | NoSuchElementException | NullPointerException e) { @@ -156,7 +161,7 @@ protected boolean standardContainsKey(@CheckForNull Object key) { * @since 7.0 */ @Beta - protected SortedMap standardSubMap(K fromKey, K toKey) { + protected @PolyMutable SortedMap standardSubMap(@PolyMutable ForwardingSortedMap this, K fromKey, K toKey) { checkArgument(unsafeCompare(comparator(), fromKey, toKey) <= 0, "fromKey must be <= toKey"); return tailMap(fromKey).headMap(toKey); } diff --git a/guava/src/com/google/common/collect/ForwardingSortedMultiset.java b/guava/src/com/google/common/collect/ForwardingSortedMultiset.java index 4626d3193a58..91b0a406e5ba 100644 --- a/guava/src/com/google/common/collect/ForwardingSortedMultiset.java +++ b/guava/src/com/google/common/collect/ForwardingSortedMultiset.java @@ -21,6 +21,8 @@ import java.util.NavigableSet; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * A sorted multiset which forwards all its method calls to another sorted multiset. Subclasses @@ -47,7 +49,8 @@ @Beta @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -public abstract class ForwardingSortedMultiset +@ReceiverDependentMutable +public abstract class ForwardingSortedMultiset extends ForwardingMultiset implements SortedMultiset { /** Constructor for use by subclasses. */ protected ForwardingSortedMultiset() {} @@ -73,6 +76,7 @@ public NavigableSet elementSet() { * * @since 15.0 */ + @ReceiverDependentMutable protected class StandardElementSet extends SortedMultisets.NavigableElementSet { /** Constructor for use by subclasses. */ public StandardElementSet() { @@ -102,6 +106,7 @@ public SortedMultiset descendingMultiset() { * * @since 15.0 */ + @ReceiverDependentMutable protected abstract class StandardDescendingMultiset extends DescendingMultiset { /** Constructor for use by subclasses. */ public StandardDescendingMultiset() {} diff --git a/guava/src/com/google/common/collect/ForwardingSortedSet.java b/guava/src/com/google/common/collect/ForwardingSortedSet.java index ede284ebf738..05d3adc140f4 100644 --- a/guava/src/com/google/common/collect/ForwardingSortedSet.java +++ b/guava/src/com/google/common/collect/ForwardingSortedSet.java @@ -26,6 +26,10 @@ import java.util.SortedSet; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; @@ -59,51 +63,52 @@ @AnnotatedFor({"nullness"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ForwardingSortedSet extends ForwardingSet +@ReceiverDependentMutable +public abstract class ForwardingSortedSet extends ForwardingSet implements SortedSet { /** Constructor for use by subclasses. */ protected ForwardingSortedSet() {} @Override - protected abstract SortedSet delegate(); + protected abstract @PolyMutable SortedSet delegate(@PolyMutable ForwardingSortedSet this); @SideEffectFree @Override @CheckForNull - public Comparator comparator() { + public Comparator comparator(@Readonly ForwardingSortedSet this) { return delegate().comparator(); } @SideEffectFree @Override @ParametricNullness - public E first() { + public E first(@Readonly ForwardingSortedSet this) { return delegate().first(); } @SideEffectFree @Override - public SortedSet headSet(@ParametricNullness E toElement) { + public SortedSet headSet(@Readonly ForwardingSortedSet this, @ParametricNullness E toElement) { return delegate().headSet(toElement); } @SideEffectFree @Override @ParametricNullness - public E last() { + public E last(@Readonly ForwardingSortedSet this) { return delegate().last(); } @SideEffectFree @Override - public SortedSet subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) { + public @PolyMutable SortedSet subSet(@PolyMutable ForwardingSortedSet this, @ParametricNullness E fromElement, @ParametricNullness E toElement) { return delegate().subSet(fromElement, toElement); } @SideEffectFree @Override - public SortedSet tailSet(@ParametricNullness E fromElement) { + public @PolyMutable SortedSet tailSet(@PolyMutable ForwardingSortedSet this, @ParametricNullness E fromElement) { return delegate().tailSet(fromElement); } @@ -116,7 +121,7 @@ public SortedSet tailSet(@ParametricNullness E fromElement) { */ @Override @Beta - protected boolean standardContains(@CheckForNull Object object) { + protected boolean standardContains(@Readonly ForwardingSortedSet this, @CheckForNull @Readonly Object object) { try { // any ClassCastExceptions and NullPointerExceptions are caught @SuppressWarnings({"unchecked", "nullness"}) @@ -137,7 +142,7 @@ protected boolean standardContains(@CheckForNull Object object) { */ @Override @Beta - protected boolean standardRemove(@CheckForNull Object object) { + protected boolean standardRemove(@Mutable ForwardingSortedSet this, @CheckForNull @Readonly Object object) { try { // any ClassCastExceptions and NullPointerExceptions are caught @SuppressWarnings({"unchecked", "nullness"}) @@ -164,7 +169,7 @@ protected boolean standardRemove(@CheckForNull Object object) { * @since 7.0 */ @Beta - protected SortedSet standardSubSet( + protected SortedSet standardSubSet(@Readonly ForwardingSortedSet this, @ParametricNullness E fromElement, @ParametricNullness E toElement) { return tailSet(fromElement).headSet(toElement); } diff --git a/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java b/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java index b91a68b3445a..cb0c77a5681d 100644 --- a/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java +++ b/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java @@ -21,6 +21,10 @@ import java.util.SortedSet; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * A sorted set multimap which forwards all its method calls to another sorted set multimap. @@ -36,8 +40,9 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault +@ReceiverDependentMutable public abstract class ForwardingSortedSetMultimap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends ForwardingSetMultimap implements SortedSetMultimap { /** Constructor for use by subclasses. */ @@ -47,17 +52,17 @@ protected ForwardingSortedSetMultimap() {} protected abstract SortedSetMultimap delegate(); @Override - public SortedSet get(@ParametricNullness K key) { + public SortedSet get(@Readonly ForwardingSortedSetMultimap this, @ParametricNullness K key) { return delegate().get(key); } @Override - public SortedSet removeAll(@CheckForNull Object key) { + public SortedSet removeAll(@Mutable ForwardingSortedSetMultimap this, @CheckForNull @Mutable Object key) { return delegate().removeAll(key); } @Override - public SortedSet replaceValues(@ParametricNullness K key, Iterable values) { + public SortedSet replaceValues(@Mutable ForwardingSortedSetMultimap this, @ParametricNullness K key, Iterable values) { return delegate().replaceValues(key, values); } diff --git a/guava/src/com/google/common/collect/ForwardingTable.java b/guava/src/com/google/common/collect/ForwardingTable.java index 969118d81f2c..cdb430e2ac22 100644 --- a/guava/src/com/google/common/collect/ForwardingTable.java +++ b/guava/src/com/google/common/collect/ForwardingTable.java @@ -23,6 +23,10 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -35,8 +39,9 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault +@ReceiverDependentMutable public abstract class ForwardingTable< - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends ForwardingObject implements Table { /** Constructor for use by subclasses. */ protected ForwardingTable() {} @@ -45,12 +50,12 @@ protected ForwardingTable() {} protected abstract Table delegate(); @Override - public Set> cellSet() { + public @ReceiverDependentMutable Set> cellSet() { return delegate().cellSet(); } @Override - public void clear() { + public void clear(@Mutable ForwardingTable this) { delegate().clear(); } @@ -103,20 +108,20 @@ public boolean isEmpty() { @CanIgnoreReturnValue @Override @CheckForNull - public V put( + public V put(@Mutable ForwardingTable this, @ParametricNullness R rowKey, @ParametricNullness C columnKey, @ParametricNullness V value) { return delegate().put(rowKey, columnKey, value); } @Override - public void putAll(Table table) { + public void putAll(@Mutable ForwardingTable this, Table table) { delegate().putAll(table); } @CanIgnoreReturnValue @Override @CheckForNull - public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V remove(@Mutable ForwardingTable this, @CheckForNull Object rowKey, @CheckForNull Object columnKey) { return delegate().remove(rowKey, columnKey); } diff --git a/guava/src/com/google/common/collect/GeneralRange.java b/guava/src/com/google/common/collect/GeneralRange.java index f99fafa0ae15..8521dfc89fbd 100644 --- a/guava/src/com/google/common/collect/GeneralRange.java +++ b/guava/src/com/google/common/collect/GeneralRange.java @@ -26,6 +26,7 @@ import java.util.Comparator; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -39,9 +40,9 @@ */ @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -final class GeneralRange implements Serializable { +final class GeneralRange implements Serializable { /** Converts a Range to a GeneralRange. */ - static GeneralRange from(Range range) { + static GeneralRange from(Range range) { T lowerEndpoint = range.hasLowerBound() ? range.lowerEndpoint() : null; BoundType lowerBoundType = range.hasLowerBound() ? range.lowerBoundType() : OPEN; @@ -58,7 +59,7 @@ static GeneralRange from(Range range) { } /** Returns the whole range relative to the specified comparator. */ - static GeneralRange all(Comparator comparator) { + static GeneralRange all(Comparator comparator) { return new GeneralRange<>(comparator, false, null, OPEN, false, null, OPEN); } @@ -66,7 +67,7 @@ static GeneralRange from(Range range) { * Returns everything above the endpoint relative to the specified comparator, with the specified * endpoint behavior. */ - static GeneralRange downTo( + static GeneralRange downTo( Comparator comparator, @ParametricNullness T endpoint, BoundType boundType) { return new GeneralRange<>(comparator, true, endpoint, boundType, false, null, OPEN); } @@ -75,7 +76,7 @@ static GeneralRange from(Range range) { * Returns everything below the endpoint relative to the specified comparator, with the specified * endpoint behavior. */ - static GeneralRange upTo( + static GeneralRange upTo( Comparator comparator, @ParametricNullness T endpoint, BoundType boundType) { return new GeneralRange<>(comparator, false, null, OPEN, true, endpoint, boundType); } @@ -84,7 +85,7 @@ static GeneralRange from(Range range) { * Returns everything between the endpoints relative to the specified comparator, with the * specified endpoint behavior. */ - static GeneralRange range( + static GeneralRange range( Comparator comparator, @ParametricNullness T lower, BoundType lowerType, @@ -238,7 +239,7 @@ GeneralRange intersect(GeneralRange other) { } @Override - public boolean equals(@CheckForNull Object obj) { + public boolean equals(@CheckForNull @Readonly Object obj) { if (obj instanceof GeneralRange) { GeneralRange r = (GeneralRange) obj; return comparator.equals(r.comparator) diff --git a/guava/src/com/google/common/collect/HashBasedTable.java b/guava/src/com/google/common/collect/HashBasedTable.java index 21882e62d406..ac208c65541d 100644 --- a/guava/src/com/google/common/collect/HashBasedTable.java +++ b/guava/src/com/google/common/collect/HashBasedTable.java @@ -24,6 +24,9 @@ import java.util.LinkedHashMap; import java.util.Map; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; + /** * Implementation of {@link Table} using linked hash tables. This guarantees predictable iteration * order of the various views. @@ -48,8 +51,10 @@ */ @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -public class HashBasedTable extends StandardTable { - private static class Factory implements Supplier>, Serializable { +@ReceiverDependentMutable +public class HashBasedTable extends StandardTable { + @ReceiverDependentMutable + private static class Factory implements Supplier>, Serializable { final int expectedSize; Factory(int expectedSize) { @@ -65,7 +70,7 @@ public Map get() { } /** Creates an empty {@code HashBasedTable}. */ - public static HashBasedTable create() { + public static HashBasedTable create() { return new HashBasedTable<>(new LinkedHashMap>(), new Factory(0)); } @@ -77,7 +82,7 @@ public static HashBasedTable create() { * @throws IllegalArgumentException if {@code expectedRows} or {@code expectedCellsPerRow} is * negative */ - public static HashBasedTable create( + public static HashBasedTable create( int expectedRows, int expectedCellsPerRow) { checkNonnegative(expectedCellsPerRow, "expectedCellsPerRow"); Map> backingMap = Maps.newLinkedHashMapWithExpectedSize(expectedRows); @@ -91,14 +96,14 @@ public static HashBasedTable create( * @throws NullPointerException if any of the row keys, column keys, or values in {@code table} is * null */ - public static HashBasedTable create( + public static HashBasedTable create( Table table) { HashBasedTable result = create(); result.putAll(table); return result; } - HashBasedTable(Map> backingMap, Factory factory) { + HashBasedTable(@ReceiverDependentMutable Map> backingMap, @ReceiverDependentMutable Factory factory) { super(backingMap, factory); } diff --git a/guava/src/com/google/common/collect/HashBiMap.java b/guava/src/com/google/common/collect/HashBiMap.java index fe19cdb936f5..1bb66d1c05ba 100644 --- a/guava/src/com/google/common/collect/HashBiMap.java +++ b/guava/src/com/google/common/collect/HashBiMap.java @@ -44,10 +44,17 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * A {@link BiMap} backed by two hash tables. This implementation allows null keys and values. A @@ -65,11 +72,12 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -public final class HashBiMap +@ReceiverDependentMutable +public final class HashBiMap extends IteratorBasedAbstractMap implements BiMap, Serializable { /** Returns a new, empty {@code HashBiMap} with the default initial capacity (16). */ - public static HashBiMap create() { + public static HashBiMap create() { return create(16); } @@ -79,7 +87,7 @@ public final class HashBiMap HashBiMap create( + public static HashBiMap create( int expectedSize) { return new HashBiMap<>(expectedSize); } @@ -88,14 +96,15 @@ public final class HashBiMap HashBiMap create( + public static HashBiMap create( Map map) { HashBiMap bimap = create(map.size()); bimap.putAll(map); return bimap; } - private static final class BiEntry + @Immutable + private static final class BiEntry extends ImmutableEntry { final int keyHash; final int valueHash; @@ -126,13 +135,13 @@ private static final class BiEntry[] hashTableKToV; - private transient @Nullable BiEntry[] hashTableVToK; - @Weak @CheckForNull private transient BiEntry firstInKeyInsertionOrder; - @Weak @CheckForNull private transient BiEntry lastInKeyInsertionOrder; - private transient int size; - private transient int mask; - private transient int modCount; + private transient @Assignable @Nullable BiEntry[] hashTableKToV; + private transient @Assignable @Nullable BiEntry[] hashTableVToK; + @Weak @CheckForNull private transient @Assignable BiEntry firstInKeyInsertionOrder; + @Weak @CheckForNull private transient @Assignable BiEntry lastInKeyInsertionOrder; + private transient @Assignable int size; + private transient @Assignable int mask; + private transient @Assignable int modCount; private HashBiMap(int expectedSize) { init(expectedSize); @@ -154,7 +163,7 @@ private void init(int expectedSize) { * Finds and removes {@code entry} from the bucket linked lists in both the key-to-value direction * and the value-to-key direction. */ - private void delete(BiEntry entry) { + private void delete(@Mutable HashBiMap this, @Readonly BiEntry entry) { int keyBucket = entry.keyHash & mask; BiEntry prevBucketEntry = null; for (BiEntry bucketEntry = hashTableKToV[keyBucket]; @@ -203,7 +212,7 @@ private void delete(BiEntry entry) { modCount++; } - private void insert(BiEntry entry, @CheckForNull BiEntry oldEntryForKey) { + private void insert(@Mutable HashBiMap this, @Readonly BiEntry entry, @CheckForNull @Readonly BiEntry oldEntryForKey) { int keyBucket = entry.keyHash & mask; entry.nextInKToVBucket = hashTableKToV[keyBucket]; hashTableKToV[keyBucket] = entry; @@ -241,7 +250,7 @@ private void insert(BiEntry entry, @CheckForNull BiEntry oldEntryFor } @CheckForNull - private BiEntry seekByKey(@CheckForNull Object key, int keyHash) { + private BiEntry seekByKey(@CheckForNull @Readonly Object key, int keyHash) { for (BiEntry entry = hashTableKToV[keyHash & mask]; entry != null; entry = entry.nextInKToVBucket) { @@ -253,7 +262,7 @@ private BiEntry seekByKey(@CheckForNull Object key, int keyHash) { } @CheckForNull - private BiEntry seekByValue(@CheckForNull Object value, int valueHash) { + private BiEntry seekByValue(@CheckForNull @Readonly Object value, int valueHash) { for (BiEntry entry = hashTableVToK[valueHash & mask]; entry != null; entry = entry.nextInVToKBucket) { @@ -265,7 +274,7 @@ private BiEntry seekByValue(@CheckForNull Object value, int valueHash) { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly HashBiMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return seekByKey(key, smearedHash(key)) != null; } @@ -281,25 +290,25 @@ public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { */ @Pure @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly HashBiMap this, @CheckForNull @UnknownSignedness @Readonly Object value) { return seekByValue(value, smearedHash(value)) != null; } @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@Readonly HashBiMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return Maps.valueOrNull(seekByKey(key, smearedHash(key))); } @CanIgnoreReturnValue @Override @CheckForNull - public V put(@ParametricNullness K key, @ParametricNullness V value) { + public V put(@Mutable HashBiMap this, @ParametricNullness K key, @ParametricNullness V value) { return put(key, value, false); } @CheckForNull - private V put(@ParametricNullness K key, @ParametricNullness V value, boolean force) { + private V put(@Mutable HashBiMap this, @ParametricNullness K key, @ParametricNullness V value, boolean force) { int keyHash = smearedHash(key); int valueHash = smearedHash(value); @@ -336,12 +345,12 @@ private V put(@ParametricNullness K key, @ParametricNullness V value, boolean fo @CanIgnoreReturnValue @Override @CheckForNull - public V forcePut(@ParametricNullness K key, @ParametricNullness V value) { + public V forcePut(@Mutable HashBiMap this, @ParametricNullness K key, @ParametricNullness V value) { return put(key, value, true); } @CheckForNull - private K putInverse(@ParametricNullness V value, @ParametricNullness K key, boolean force) { + private K putInverse(@Mutable HashBiMap this, @ParametricNullness V value, @ParametricNullness K key, boolean force) { int valueHash = smearedHash(value); int keyHash = smearedHash(key); @@ -412,7 +421,7 @@ private void rehashIfNecessary() { @CanIgnoreReturnValue @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@Mutable HashBiMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { BiEntry entry = seekByKey(key, smearedHash(key)); if (entry == null) { return null; @@ -425,7 +434,7 @@ public V remove(@CheckForNull @UnknownSignedness Object key) { } @Override - public void clear() { + public void clear(@Mutable HashBiMap this) { size = 0; Arrays.fill(hashTableKToV, null); Arrays.fill(hashTableVToK, null); @@ -435,11 +444,12 @@ public void clear() { } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly HashBiMap this) { return size; } - abstract class Itr implements Iterator { + @ReceiverDependentMutable + abstract class Itr implements Iterator { @CheckForNull BiEntry next = firstInKeyInsertionOrder; @CheckForNull BiEntry toRemove = null; int expectedModCount = modCount; @@ -468,7 +478,7 @@ public T next() { } @Override - public void remove() { + public void remove(@Mutable Itr this) { if (modCount != expectedModCount) { throw new ConcurrentModificationException(); } @@ -484,10 +494,11 @@ public void remove() { } @Override - public Set<@KeyFor({"this"}) K> keySet() { - return new KeySet(); + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable HashBiMap this) { + return new @PolyMutable KeySet(); } + @ReceiverDependentMutable private final class KeySet extends Maps.KeySet { KeySet() { super(HashBiMap.this); @@ -505,7 +516,7 @@ K output(BiEntry entry) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable KeySet this, @CheckForNull @UnknownSignedness @Readonly Object o) { BiEntry entry = seekByKey(o, smearedHash(o)); if (entry == null) { return false; @@ -519,7 +530,7 @@ public boolean remove(@CheckForNull @UnknownSignedness Object o) { } @Override - public Set values() { + public @PolyMutable Set values(@PolyMutable HashBiMap this) { return inverse().keySet(); } @@ -595,57 +606,59 @@ public void replaceAll(BiFunction function) { } } - @LazyInit @RetainedWith @CheckForNull private transient BiMap inverse; + @CFComment("Change to @LazyFinal later") + @LazyInit @RetainedWith @CheckForNull private transient @Assignable BiMap inverse; @Override - public BiMap inverse() { + public @PolyMutable BiMap inverse(@PolyMutable HashBiMap this) { BiMap result = inverse; return (result == null) ? inverse = new Inverse() : result; } + @ReceiverDependentMutable private final class Inverse extends IteratorBasedAbstractMap implements BiMap, Serializable { - BiMap forward() { + @PolyMutable BiMap forward(@PolyMutable Inverse this) { return HashBiMap.this; } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly Inverse this) { return size; } @Override - public void clear() { + public void clear(@Mutable Inverse this) { forward().clear(); } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object value) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object value) { return forward().containsValue(value); } @Override @CheckForNull - public K get(@CheckForNull @UnknownSignedness Object value) { + public K get(@CheckForNull @UnknownSignedness @Readonly Object value) { return Maps.keyOrNull(seekByValue(value, smearedHash(value))); } @CanIgnoreReturnValue @Override @CheckForNull - public K put(@ParametricNullness V value, @ParametricNullness K key) { + public K put(@Mutable Inverse this, @ParametricNullness V value, @ParametricNullness K key) { return putInverse(value, key, false); } @Override @CheckForNull - public K forcePut(@ParametricNullness V value, @ParametricNullness K key) { + public K forcePut(@Mutable Inverse this, @ParametricNullness V value, @ParametricNullness K key) { return putInverse(value, key, true); } @Override @CheckForNull - public K remove(@CheckForNull @UnknownSignedness Object value) { + public K remove(@Mutable Inverse this, @CheckForNull @UnknownSignedness @Readonly Object value) { BiEntry entry = seekByValue(value, smearedHash(value)); if (entry == null) { return null; @@ -658,15 +671,16 @@ public K remove(@CheckForNull @UnknownSignedness Object value) { } @Override - public BiMap inverse() { + public @PolyMutable BiMap inverse(@PolyMutable Inverse this) { return forward(); } @Override - public Set<@KeyFor({"this"}) V> keySet() { - return new InverseKeySet(); + public @PolyMutable Set<@KeyFor({"this"}) V> keySet(@PolyMutable Inverse this) { + return new @PolyMutable InverseKeySet(); } + @ReceiverDependentMutable private final class InverseKeySet extends Maps.KeySet { InverseKeySet() { super(Inverse.this); @@ -755,7 +769,7 @@ public void forEach(BiConsumer action) { } @Override - public void replaceAll(BiFunction function) { + public void replaceAll(@Mutable Inverse this, BiFunction function) { checkNotNull(function); BiEntry oldFirst = firstInKeyInsertionOrder; clear(); @@ -769,8 +783,9 @@ Object writeReplace() { } } + @ReceiverDependentMutable private static final class InverseSerializedForm< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Immutable Object> implements Serializable { private final HashBiMap bimap; diff --git a/guava/src/com/google/common/collect/HashMultimap.java b/guava/src/com/google/common/collect/HashMultimap.java index 0aac491bf1d3..36fccc0090cf 100644 --- a/guava/src/com/google/common/collect/HashMultimap.java +++ b/guava/src/com/google/common/collect/HashMultimap.java @@ -27,8 +27,14 @@ import java.util.Map; import java.util.Set; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * Implementation of {@link Multimap} using hash tables. @@ -50,10 +56,11 @@ * @author Jared Levy * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public final class HashMultimap +@ReceiverDependentMutable +public final class HashMultimap extends HashMultimapGwtSerializationDependencies { private static final int DEFAULT_VALUES_PER_KEY = 2; @@ -65,7 +72,7 @@ public final class HashMultimapThis method will soon be deprecated in favor of {@code * MultimapBuilder.hashKeys().hashSetValues().build()}. */ - public static + public static HashMultimap create() { return new HashMultimap<>(); } @@ -82,7 +89,7 @@ HashMultimap create() { * @throws IllegalArgumentException if {@code expectedKeys} or {@code expectedValuesPerKey} is * negative */ - public static HashMultimap create( + public static HashMultimap create( int expectedKeys, int expectedValuesPerKey) { return new HashMultimap<>(expectedKeys, expectedValuesPerKey); } @@ -97,9 +104,10 @@ HashMultimap create() { * * @param multimap the multimap whose contents are copied to this multimap */ - public static HashMultimap create( - Multimap multimap) { - return new HashMultimap<>(multimap); + @CFComment("PICO: good example to have poly only for mutable and immutable, like boolean algebra") + public static @PolyMutable HashMultimap create( + @PolyMutable Multimap multimap) { + return new @PolyMutable HashMultimap<>(multimap); } private HashMultimap() { @@ -107,13 +115,14 @@ private HashMultimap() { } private HashMultimap(int expectedKeys, int expectedValuesPerKey) { - super(Platform.>newHashMapWithExpectedSize(expectedKeys)); + super(Platform.>newHashMapWithExpectedSize(expectedKeys)); Preconditions.checkArgument(expectedValuesPerKey >= 0); this.expectedValuesPerKey = expectedValuesPerKey; } - private HashMultimap(Multimap multimap) { - super(Platform.>newHashMapWithExpectedSize(multimap.keySet().size())); + @SuppressWarnings("pico:method.invocation.invalid") // Putall method + private HashMultimap(@ReceiverDependentMutable Multimap multimap) { + super(Platform.>newHashMapWithExpectedSize(multimap.keySet().size())); putAll(multimap); } @@ -125,7 +134,7 @@ private HashMultimap(Multimap multimap) { * @return a new {@code HashSet} containing a collection of values for one key */ @Override - Set createCollection() { + @PolyMutable Set createCollection(@PolyMutable HashMultimap this) { return Platform.newHashSetWithExpectedSize(expectedValuesPerKey); } @@ -154,11 +163,11 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo @Pure @Override -public boolean equals(@Nullable Object arg0) { return super.equals(arg0); } +public boolean equals(@Readonly HashMultimap this, @Nullable @Readonly Object arg0) { return super.equals(arg0); } @Override -public Set get(@Nullable K arg0) { return super.get(arg0); } +public @PolyMutable Set get(@PolyMutable HashMultimap this, @Nullable K arg0) { return super.get(arg0); } @Override -public Set removeAll(@Nullable Object arg0) { return super.removeAll(arg0); } +public @Readonly Set removeAll(@Mutable HashMultimap this, @Nullable @Readonly Object arg0) { return super.removeAll(arg0); } } diff --git a/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java b/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java index 0922c3839080..730113f54643 100644 --- a/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java +++ b/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java @@ -17,6 +17,11 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; + import java.util.Collection; import java.util.Map; @@ -29,9 +34,11 @@ * *

TODO(cpovirk): Consider applying this subclass approach to our other types. */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) -abstract class HashMultimapGwtSerializationDependencies extends AbstractSetMultimap { - HashMultimapGwtSerializationDependencies(Map> map) { +@ReceiverDependentMutable +abstract class HashMultimapGwtSerializationDependencies extends AbstractSetMultimap { + HashMultimapGwtSerializationDependencies(@ReceiverDependentMutable Map> map) { super(map); } } diff --git a/guava/src/com/google/common/collect/HashMultiset.java b/guava/src/com/google/common/collect/HashMultiset.java index 20edf8de93eb..70233d9f5ecb 100644 --- a/guava/src/com/google/common/collect/HashMultiset.java +++ b/guava/src/com/google/common/collect/HashMultiset.java @@ -24,6 +24,10 @@ import java.util.HashMap; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.framework.qual.AnnotatedFor; @@ -37,10 +41,11 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public final class HashMultiset extends AbstractMapBasedMultiset { +@ReceiverDependentMutable +public final class HashMultiset extends AbstractMapBasedMultiset { /** Creates a new, empty {@code HashMultiset} using the default initial capacity. */ - public static HashMultiset create() { + public static HashMultiset create() { return new HashMultiset(); } @@ -51,7 +56,7 @@ public final class HashMultiset extends AbstractMapB * @param distinctElements the expected number of distinct elements * @throws IllegalArgumentException if {@code distinctElements} is negative */ - public static HashMultiset create(int distinctElements) { + public static HashMultiset create(int distinctElements) { return new HashMultiset(distinctElements); } @@ -62,8 +67,8 @@ public final class HashMultiset extends AbstractMapB * * @param elements the elements that the multiset should contain */ - public static HashMultiset create( - Iterable elements) { + public static HashMultiset create( + @Readonly Iterable elements) { HashMultiset multiset = create(Multisets.inferDistinctElements(elements)); Iterables.addAll(multiset, elements); return multiset; @@ -99,11 +104,11 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo private static final long serialVersionUID = 0; @Override -public boolean contains(@Nullable @UnknownSignedness Object arg0) { return super.contains(arg0); } +public boolean contains(@Readonly HashMultiset this, @Nullable @UnknownSignedness @Readonly Object arg0) { return super.contains(arg0); } @Override -public @NonNegative int count(@Nullable @UnknownSignedness Object arg0) { return super.count(arg0); } +public @NonNegative int count(@Readonly HashMultiset this, @Nullable @UnknownSignedness @Readonly Object arg0) { return super.count(arg0); } @Override -public int remove(@Nullable Object arg0, int arg1) { return super.remove(arg0, arg1); } +public int remove(@Mutable HashMultiset this, @Nullable @Readonly Object arg0, int arg1) { return super.remove(arg0, arg1); } } diff --git a/guava/src/com/google/common/collect/Hashing.java b/guava/src/com/google/common/collect/Hashing.java index 7421b40ba0b4..8905920cf916 100644 --- a/guava/src/com/google/common/collect/Hashing.java +++ b/guava/src/com/google/common/collect/Hashing.java @@ -20,6 +20,7 @@ import com.google.common.primitives.Ints; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -56,7 +57,7 @@ static int smear(int hashCode) { return (int) (C2 * Integer.rotateLeft((int) (hashCode * C1), 15)); } - static int smearedHash(@CheckForNull Object o) { + static int smearedHash(@CheckForNull @Readonly Object o) { return smear((o == null) ? 0 : o.hashCode()); } diff --git a/guava/src/com/google/common/collect/ImmutableAsList.java b/guava/src/com/google/common/collect/ImmutableAsList.java index f3dfdecaa372..353a2505c87d 100644 --- a/guava/src/com/google/common/collect/ImmutableAsList.java +++ b/guava/src/com/google/common/collect/ImmutableAsList.java @@ -24,7 +24,10 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * List returned by {@link ImmutableCollection#asList} that delegates {@code contains} checks to the @@ -33,14 +36,16 @@ * @author Jared Levy * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") @ElementTypesAreNonnullByDefault +@Immutable abstract class ImmutableAsList extends ImmutableList { abstract ImmutableCollection delegateCollection(); @Override - public boolean contains(@CheckForNull @UnknownSignedness Object target) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object target) { // The collection's contains() is at least as fast as ImmutableList's // and is often faster. return delegateCollection().contains(target); @@ -70,7 +75,7 @@ static class SerializedForm implements Serializable { this.collection = collection; } - Object readResolve() { + @Immutable Object readResolve() { return collection.asList(); } diff --git a/guava/src/com/google/common/collect/ImmutableBiMap.java b/guava/src/com/google/common/collect/ImmutableBiMap.java index 8e6799c15127..b77821d662bb 100644 --- a/guava/src/com/google/common/collect/ImmutableBiMap.java +++ b/guava/src/com/google/common/collect/ImmutableBiMap.java @@ -34,6 +34,8 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; @@ -48,7 +50,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public abstract class ImmutableBiMap extends ImmutableBiMapFauxverideShim +@Immutable +public abstract class ImmutableBiMap extends ImmutableBiMapFauxverideShim implements BiMap { /** @@ -63,7 +66,7 @@ public abstract class ImmutableBiMap extends ImmutableBiMapFauxverideShim< * * @since 21.0 */ - public static + public static Collector> toImmutableBiMap( Function keyFunction, Function valueFunction) { @@ -77,12 +80,12 @@ public abstract class ImmutableBiMap extends ImmutableBiMapFauxverideShim< */ // Casting to any type is safe because the set will never hold any elements. @SuppressWarnings("unchecked") - public static ImmutableBiMap of() { + public static ImmutableBiMap of() { return (ImmutableBiMap) RegularImmutableBiMap.EMPTY; } /** Returns an immutable bimap containing a single entry. */ - public static ImmutableBiMap of(K k1, V v1) { + public static ImmutableBiMap of(K k1, V v1) { return new SingletonImmutableBiMap<>(k1, v1); } @@ -91,7 +94,7 @@ public static ImmutableBiMap of(K k1, V v1) { * * @throws IllegalArgumentException if duplicate keys or values are added */ - public static ImmutableBiMap of(K k1, V v1, K k2, V v2) { + public static ImmutableBiMap of(K k1, V v1, K k2, V v2) { return RegularImmutableBiMap.fromEntries(entryOf(k1, v1), entryOf(k2, v2)); } @@ -100,7 +103,7 @@ public static ImmutableBiMap of(K k1, V v1, K k2, V v2) { * * @throws IllegalArgumentException if duplicate keys or values are added */ - public static ImmutableBiMap of(K k1, V v1, K k2, V v2, K k3, V v3) { + public static ImmutableBiMap of(K k1, V v1, K k2, V v2, K k3, V v3) { return RegularImmutableBiMap.fromEntries(entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3)); } @@ -109,7 +112,7 @@ public static ImmutableBiMap of(K k1, V v1, K k2, V v2, K k3, V v3) * * @throws IllegalArgumentException if duplicate keys or values are added */ - public static ImmutableBiMap of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { + public static ImmutableBiMap of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { return RegularImmutableBiMap.fromEntries( entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3), entryOf(k4, v4)); } @@ -119,7 +122,7 @@ public static ImmutableBiMap of(K k1, V v1, K k2, V v2, K k3, V v3, * * @throws IllegalArgumentException if duplicate keys or values are added */ - public static ImmutableBiMap of( + public static ImmutableBiMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) { return RegularImmutableBiMap.fromEntries( entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3), entryOf(k4, v4), entryOf(k5, v5)); @@ -131,7 +134,7 @@ public static ImmutableBiMap of( * @throws IllegalArgumentException if duplicate keys or values are added * @since 31.0 */ - public static ImmutableBiMap of( + public static ImmutableBiMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) { return RegularImmutableBiMap.fromEntries( entryOf(k1, v1), @@ -148,7 +151,7 @@ public static ImmutableBiMap of( * @throws IllegalArgumentException if duplicate keys or values are added * @since 31.0 */ - public static ImmutableBiMap of( + public static ImmutableBiMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) { return RegularImmutableBiMap.fromEntries( entryOf(k1, v1), @@ -166,7 +169,7 @@ public static ImmutableBiMap of( * @throws IllegalArgumentException if duplicate keys or values are added * @since 31.0 */ - public static ImmutableBiMap of( + public static ImmutableBiMap of( K k1, V v1, K k2, @@ -200,7 +203,7 @@ public static ImmutableBiMap of( * @throws IllegalArgumentException if duplicate keys or values are added * @since 31.0 */ - public static ImmutableBiMap of( + public static ImmutableBiMap of( K k1, V v1, K k2, @@ -236,7 +239,7 @@ public static ImmutableBiMap of( * @throws IllegalArgumentException if duplicate keys or values are added * @since 31.0 */ - public static ImmutableBiMap of( + public static ImmutableBiMap of( K k1, V v1, K k2, @@ -279,7 +282,7 @@ public static ImmutableBiMap of( * @since 31.0 */ @SafeVarargs - public static ImmutableBiMap ofEntries(Entry... entries) { + public static ImmutableBiMap ofEntries(Entry... entries) { @SuppressWarnings("unchecked") // we will only ever read these Entry[] entries2 = (Entry[]) entries; return RegularImmutableBiMap.fromEntries(entries2); @@ -289,7 +292,7 @@ public static ImmutableBiMap ofEntries(Entry Builder builder() { + public static Builder builder() { return new Builder<>(); } @@ -306,7 +309,7 @@ public static Builder builder() { * @since 23.1 */ @Beta - public static Builder builderWithExpectedSize(int expectedSize) { + public static Builder builderWithExpectedSize(int expectedSize) { checkNonnegative(expectedSize, "expectedSize"); return new Builder<>(expectedSize); } @@ -339,7 +342,7 @@ public static Builder builderWithExpectedSize(int expectedSize) { * * @since 2.0 */ - public static final class Builder extends ImmutableMap.Builder { + public static final @Mutable class Builder extends ImmutableMap.Builder { /** * Creates a new builder. The returned builder is equivalent to the builder generated by {@link @@ -536,7 +539,7 @@ ImmutableBiMap buildJdkBacked() { * key * @throws NullPointerException if any key or value in {@code map} is null */ - public static ImmutableBiMap copyOf(Map map) { + public static ImmutableBiMap copyOf(Map map) { if (map instanceof ImmutableBiMap) { @SuppressWarnings("unchecked") // safe since map is not writable ImmutableBiMap bimap = (ImmutableBiMap) map; @@ -559,7 +562,7 @@ public static ImmutableBiMap copyOf(Map m * @since 19.0 */ @Beta - public static ImmutableBiMap copyOf( + public static ImmutableBiMap copyOf( Iterable> entries) { @SuppressWarnings("unchecked") // we'll only be using getKey and getValue, which are covariant Entry[] entryArray = (Entry[]) Iterables.toArray(entries, EMPTY_ENTRY_ARRAY); @@ -626,7 +629,7 @@ public final V forcePut(K key, V value) { *

Since the bimap is immutable, ImmutableBiMap doesn't require special logic for keeping the * bimap and its inverse in sync during serialization, the way AbstractBiMap does. */ - private static class SerializedForm extends ImmutableMap.SerializedForm { + private static class SerializedForm extends ImmutableMap.SerializedForm { SerializedForm(ImmutableBiMap bimap) { super(bimap); } diff --git a/guava/src/com/google/common/collect/ImmutableBiMapFauxverideShim.java b/guava/src/com/google/common/collect/ImmutableBiMapFauxverideShim.java index 2f1f25c82982..29449acbd2fe 100644 --- a/guava/src/com/google/common/collect/ImmutableBiMapFauxverideShim.java +++ b/guava/src/com/google/common/collect/ImmutableBiMapFauxverideShim.java @@ -22,6 +22,7 @@ import java.util.function.Function; import java.util.stream.Collector; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; /** * "Overrides" the {@link ImmutableMap} static methods that lack {@link ImmutableBiMap} equivalents @@ -32,7 +33,8 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault -abstract class ImmutableBiMapFauxverideShim extends ImmutableMap { +@Immutable +abstract class ImmutableBiMapFauxverideShim extends ImmutableMap { /** * Not supported. Use {@link ImmutableBiMap#toImmutableBiMap} instead. This method exists only to * hide {@link ImmutableMap#toImmutableMap(Function, Function)} from consumers of {@code @@ -43,7 +45,7 @@ abstract class ImmutableBiMapFauxverideShim extends ImmutableMap { */ @Deprecated @DoNotCall("Use toImmutableBiMap") - public static + public static Collector> toImmutableMap( Function keyFunction, Function valueFunction) { @@ -60,7 +62,7 @@ abstract class ImmutableBiMapFauxverideShim extends ImmutableMap { */ @Deprecated @DoNotCall("Use toImmutableBiMap") - public static + public static Collector> toImmutableMap( Function keyFunction, Function valueFunction, diff --git a/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java b/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java index 7ca083704284..3514083bcbcb 100644 --- a/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java +++ b/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java @@ -22,11 +22,14 @@ import com.google.common.primitives.Primitives; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.DoNotCall; -import com.google.errorprone.annotations.Immutable; +//import com.google.errorprone.annotations.Immutable; import java.io.Serializable; import java.util.Map; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -36,14 +39,15 @@ * @author Kevin Bourrillion * @since 2.0 */ -@AnnotatedFor({"nullness"}) -@Immutable(containerOf = "B") +@AnnotatedFor({"nullness", "pico"}) +//@Immutable(containerOf = "B") @GwtIncompatible @ElementTypesAreNonnullByDefault +@Immutable public final class ImmutableClassToInstanceMap extends ForwardingMap, B> implements ClassToInstanceMap, Serializable { - private static final ImmutableClassToInstanceMap EMPTY = + private static final ImmutableClassToInstanceMap<@Readonly Object> EMPTY = new ImmutableClassToInstanceMap<>(ImmutableMap., Object>of()); /** @@ -63,8 +67,8 @@ public static ImmutableClassToInstanceMap of() { * * @since 19.0 */ - public static ImmutableClassToInstanceMap of(Class type, T value) { - ImmutableMap, B> map = ImmutableMap., B>of(type, value); + public static ImmutableClassToInstanceMap of(@Immutable Class type, T value) { + ImmutableMap<@Immutable Class, B> map = ImmutableMap.<@Immutable Class, B>of(type, value); return new ImmutableClassToInstanceMap<>(map); } @@ -93,7 +97,7 @@ public static Builder builder() { * * @since 2.0 */ - public static final class Builder { + public static final @Mutable class Builder { private final ImmutableMap.Builder, B> mapBuilder = ImmutableMap.builder(); /** @@ -171,7 +175,7 @@ private ImmutableClassToInstanceMap(ImmutableMap, B> delegate } @Override - protected Map, B> delegate() { + protected @Immutable Map, B> delegate() { return delegate; } @@ -197,7 +201,7 @@ public T putInstance(Class type, T value) { throw new UnsupportedOperationException(); } - Object readResolve() { + @Immutable Object readResolve() { return isEmpty() ? of() : this; } } diff --git a/guava/src/com/google/common/collect/ImmutableCollection.java b/guava/src/com/google/common/collect/ImmutableCollection.java index 646d813ab3c4..0682b65bec3a 100644 --- a/guava/src/com/google/common/collect/ImmutableCollection.java +++ b/guava/src/com/google/common/collect/ImmutableCollection.java @@ -36,10 +36,14 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * A {@link Collection} whose contents will never change, and which offers a few additional @@ -173,7 +177,8 @@ @ElementTypesAreNonnullByDefault // TODO(kevinb): I think we should push everything down to "BaseImmutableCollection" or something, // just to do everything we can to emphasize the "practically an interface" nature of this class. -public abstract class ImmutableCollection extends AbstractCollection implements Serializable { +@Immutable +public abstract class ImmutableCollection extends AbstractCollection implements Serializable { /* * We expect SIZED (and SUBSIZED, if applicable) to be added by the spliterator factory methods. * These are properties of the collection as a whole; SIZED and SUBSIZED are more properties of @@ -192,11 +197,11 @@ public abstract class ImmutableCollection extends Abs public Spliterator spliterator() { return Spliterators.spliterator(this, SPLITERATOR_CHARACTERISTICS); } - - private static final Object[] EMPTY_ARRAY = {}; + @CFComment("Not sure how to annotate {} directly") + private static final Object @Mutable [] EMPTY_ARRAY = new Object @Mutable [0]; @Override - public final @PolyNull @PolySigned Object[] toArray() { + public final @PolyNull @PolySigned Object @Mutable [] toArray() { return toArray(EMPTY_ARRAY); } @@ -215,7 +220,7 @@ public Spliterator spliterator() { * nullness perspective. The signature below at least has the virtue of being relatively simple. */ @SuppressWarnings({"nullness:return", "nullness:assignment"}) - public final T[] toArray(@PolyNull T[] other) { + public final T[] toArray(@PolyNull T[] other) { checkNotNull(other); int size = size(); @@ -256,7 +261,7 @@ int internalArrayEnd() { @Pure @Override - public abstract boolean contains(@CheckForNull @UnknownSignedness Object object); + public abstract boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object); /** * Guaranteed to throw an exception and leave the collection unmodified. @@ -282,7 +287,7 @@ public final boolean add(E e) { @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") - public final boolean remove(@CheckForNull @UnknownSignedness Object object) { + public final boolean remove(@CheckForNull @UnknownSignedness @Readonly Object object) { throw new UnsupportedOperationException(); } @@ -388,7 +393,7 @@ public ImmutableList asList() { * offset. Returns {@code offset + size()}. */ @CanIgnoreReturnValue - int copyIntoArray(@Nullable Object[] dst, int offset) { + int copyIntoArray(@Nullable @Readonly Object @Mutable [] dst, int offset) { for (E e : this) { dst[offset++] = e; } diff --git a/guava/src/com/google/common/collect/ImmutableEntry.java b/guava/src/com/google/common/collect/ImmutableEntry.java index 8be1a54b4280..66b6be5fdba8 100644 --- a/guava/src/com/google/common/collect/ImmutableEntry.java +++ b/guava/src/com/google/common/collect/ImmutableEntry.java @@ -19,6 +19,8 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -26,7 +28,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -class ImmutableEntry +@Immutable +class ImmutableEntry extends AbstractMapEntry implements Serializable { @ParametricNullness final K key; @ParametricNullness final V value; diff --git a/guava/src/com/google/common/collect/ImmutableEnumMap.java b/guava/src/com/google/common/collect/ImmutableEnumMap.java index e7ad26df0ede..8601b6c65593 100644 --- a/guava/src/com/google/common/collect/ImmutableEnumMap.java +++ b/guava/src/com/google/common/collect/ImmutableEnumMap.java @@ -26,6 +26,7 @@ import java.util.function.BiConsumer; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -36,8 +37,9 @@ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization @ElementTypesAreNonnullByDefault -final class ImmutableEnumMap, V> extends IteratorBasedImmutableMap { - static , V> ImmutableMap asImmutable(EnumMap map) { +@Immutable +final class ImmutableEnumMap, V extends @Immutable Object> extends IteratorBasedImmutableMap { + static , V extends @Immutable Object> ImmutableMap asImmutable(EnumMap map) { switch (map.size()) { case 0: return ImmutableMap.of(); @@ -129,7 +131,7 @@ private static class EnumSerializedForm, V> implements Seriali this.delegate = delegate; } - Object readResolve() { + @Immutable Object readResolve() { return new ImmutableEnumMap<>(delegate); } diff --git a/guava/src/com/google/common/collect/ImmutableEnumSet.java b/guava/src/com/google/common/collect/ImmutableEnumSet.java index eee1bf09a3dc..6a973bdf5716 100644 --- a/guava/src/com/google/common/collect/ImmutableEnumSet.java +++ b/guava/src/com/google/common/collect/ImmutableEnumSet.java @@ -26,6 +26,7 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -39,9 +40,10 @@ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization @ElementTypesAreNonnullByDefault +@Immutable final class ImmutableEnumSet> extends ImmutableSet { @SuppressWarnings("rawtypes") // necessary to compile against Java 8 - static ImmutableSet asImmutable(EnumSet set) { + static ImmutableSet asImmutable(@Immutable EnumSet set) { switch (set.size()) { case 0: return ImmutableSet.of(); @@ -62,7 +64,7 @@ static ImmutableSet asImmutable(EnumSet set) { */ private final transient EnumSet delegate; - private ImmutableEnumSet(EnumSet delegate) { + private ImmutableEnumSet(@Immutable EnumSet delegate) { this.delegate = delegate; } diff --git a/guava/src/com/google/common/collect/ImmutableList.java b/guava/src/com/google/common/collect/ImmutableList.java index 1da52b5225cd..1c89d0b6cb9f 100644 --- a/guava/src/com/google/common/collect/ImmutableList.java +++ b/guava/src/com/google/common/collect/ImmutableList.java @@ -49,6 +49,9 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -65,11 +68,12 @@ * @author Kevin Bourrillion * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization @ElementTypesAreNonnullByDefault -public abstract class ImmutableList extends ImmutableCollection +@Immutable +public abstract class ImmutableList extends ImmutableCollection implements List, RandomAccess { /** @@ -78,7 +82,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @since 21.0 */ - public static Collector> toImmutableList() { + public static Collector> toImmutableList() { return CollectCollectors.toImmutableList(); } @@ -91,7 +95,7 @@ public abstract class ImmutableList extends ImmutableCollection */ // Casting to any type is safe because the list will never hold any elements. @SuppressWarnings("unchecked") - public static ImmutableList of() { + public static ImmutableList of() { return (ImmutableList) EMPTY; } @@ -102,7 +106,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if {@code element} is null */ - public static ImmutableList of(E element) { + public static ImmutableList of(E element) { return new SingletonImmutableList(element); } @@ -111,7 +115,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if any element is null */ - public static ImmutableList of(E e1, E e2) { + public static ImmutableList of(E e1, E e2) { return construct(e1, e2); } @@ -120,7 +124,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if any element is null */ - public static ImmutableList of(E e1, E e2, E e3) { + public static ImmutableList of(E e1, E e2, E e3) { return construct(e1, e2, e3); } @@ -129,7 +133,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if any element is null */ - public static ImmutableList of(E e1, E e2, E e3, E e4) { + public static ImmutableList of(E e1, E e2, E e3, E e4) { return construct(e1, e2, e3, e4); } @@ -138,7 +142,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if any element is null */ - public static ImmutableList of(E e1, E e2, E e3, E e4, E e5) { + public static ImmutableList of(E e1, E e2, E e3, E e4, E e5) { return construct(e1, e2, e3, e4, e5); } @@ -147,7 +151,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if any element is null */ - public static ImmutableList of( + public static ImmutableList of( E e1, E e2, E e3, E e4, E e5, E e6) { return construct(e1, e2, e3, e4, e5, e6); } @@ -157,7 +161,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if any element is null */ - public static ImmutableList of( + public static ImmutableList of( E e1, E e2, E e3, E e4, E e5, E e6, E e7) { return construct(e1, e2, e3, e4, e5, e6, e7); } @@ -167,7 +171,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if any element is null */ - public static ImmutableList of( + public static ImmutableList of( E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) { return construct(e1, e2, e3, e4, e5, e6, e7, e8); } @@ -177,7 +181,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if any element is null */ - public static ImmutableList of( + public static ImmutableList of( E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) { return construct(e1, e2, e3, e4, e5, e6, e7, e8, e9); } @@ -187,7 +191,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if any element is null */ - public static ImmutableList of( + public static ImmutableList of( E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) { return construct(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10); } @@ -197,7 +201,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if any element is null */ - public static ImmutableList of( + public static ImmutableList of( E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11) { return construct(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11); } @@ -214,11 +218,11 @@ public abstract class ImmutableList extends ImmutableCollection * @since 3.0 (source-compatible since 2.0) */ @SafeVarargs // For Eclipse. For internal javac we have disabled this pointless type of warning. - public static ImmutableList of( + public static ImmutableList of( E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... others) { checkArgument( others.length <= Integer.MAX_VALUE - 12, "the total number of elements must fit in an int"); - Object[] array = new Object[12 + others.length]; + @Readonly Object[] array = new @Readonly Object[12 + others.length]; array[0] = e1; array[1] = e2; array[2] = e3; @@ -242,7 +246,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if {@code elements} contains a null element */ - public static ImmutableList copyOf( + public static ImmutableList copyOf( Iterable elements) { checkNotNull(elements); // TODO(kevinb): is this here only for GWT? return (elements instanceof Collection) @@ -267,7 +271,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if {@code elements} contains a null element */ - public static ImmutableList copyOf( + public static ImmutableList copyOf( Collection elements) { if (elements instanceof ImmutableCollection) { @SuppressWarnings("unchecked") // all supported methods are covariant @@ -282,7 +286,7 @@ public abstract class ImmutableList extends ImmutableCollection * * @throws NullPointerException if {@code elements} contains a null element */ - public static ImmutableList copyOf( + public static ImmutableList copyOf( Iterator elements) { // We special-case for 0 or 1 elements, but going further is madness. if (!elements.hasNext()) { @@ -302,7 +306,7 @@ public abstract class ImmutableList extends ImmutableCollection * @throws NullPointerException if {@code elements} contains a null element * @since 3.0 */ - public static ImmutableList copyOf(E[] elements) { + public static ImmutableList copyOf(E @Readonly [] elements) { switch (elements.length) { case 0: return of(); @@ -351,7 +355,7 @@ public static > ImmutableList sortedCopyOf( * @throws NullPointerException if any element in the input is null * @since 21.0 */ - public static ImmutableList sortedCopyOf( + public static ImmutableList sortedCopyOf( Comparator comparator, Iterable elements) { checkNotNull(comparator); @SuppressWarnings("unchecked") // all supported methods are covariant @@ -362,7 +366,7 @@ public static > ImmutableList sortedCopyOf( } /** Views the array as an immutable list. Checks for nulls; does not copy. */ - private static ImmutableList construct(Object... elements) { + private static ImmutableList construct(@Readonly Object @Readonly ... elements) { return asImmutableList(checkElementsNotNull(elements)); } @@ -371,7 +375,7 @@ private static ImmutableList construct(Object... elements) { * *

The array must be internally created. */ - static ImmutableList asImmutableList(Object[] elements) { + static ImmutableList asImmutableList(@Readonly Object @Readonly [] elements) { return asImmutableList(elements, elements.length); } @@ -379,7 +383,7 @@ static ImmutableList asImmutableList(Object[] elements) { * Views the array as an immutable list. Copies if the specified range does not cover the complete * array. Does not check for nulls. */ - static ImmutableList asImmutableList(@Nullable Object[] elements, int length) { + static ImmutableList asImmutableList(@Nullable @Readonly Object @Readonly [] elements, int length) { switch (length) { case 0: return of(); @@ -397,7 +401,7 @@ static ImmutableList asImmutableList(@Nullable Object[] elements, int len * `length` array elements. */ @SuppressWarnings("nullness") - Object[] elementsWithoutTrailingNulls = + @Readonly Object @Readonly [] elementsWithoutTrailingNulls = length < elements.length ? Arrays.copyOf(elements, length) : elements; return new RegularImmutableList(elementsWithoutTrailingNulls); } @@ -419,7 +423,7 @@ public UnmodifiableListIterator listIterator() { @Override public UnmodifiableListIterator listIterator(int index) { - return new AbstractIndexedListIterator(size(), index) { + return new @Immutable AbstractIndexedListIterator(size(), index) { @Override protected E get(int index) { return ImmutableList.this.get(index); @@ -438,18 +442,18 @@ public void forEach(Consumer consumer) { } @Override - public int indexOf(@CheckForNull @UnknownSignedness Object object) { + public int indexOf(@CheckForNull @UnknownSignedness @Readonly Object object) { return (object == null) ? -1 : Lists.indexOfImpl(this, object); } @Pure @Override - public int lastIndexOf(@CheckForNull @UnknownSignedness Object object) { + public int lastIndexOf(@CheckForNull @UnknownSignedness @Readonly Object object) { return (object == null) ? -1 : Lists.lastIndexOfImpl(this, object); } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { return indexOf(object) >= 0; } @@ -483,6 +487,7 @@ ImmutableList subListUnchecked(int fromIndex, int toIndex) { return new SubList(fromIndex, toIndex - fromIndex); } + @Immutable class SubList extends ImmutableList { final transient int offset; final transient int length; @@ -616,7 +621,7 @@ public Spliterator spliterator() { } @Override - int copyIntoArray(@Nullable Object[] dst, int offset) { + int copyIntoArray(@Nullable @Readonly Object [] dst, int offset) { // this loop is faster for RandomAccess instances, which ImmutableLists are int size = size(); for (int i = 0; i < size; i++) { @@ -636,6 +641,7 @@ public ImmutableList reverse() { return (size() <= 1) ? this : new ReverseImmutableList(this); } + @Immutable private static class ReverseImmutableList extends ImmutableList { private final transient ImmutableList forwardList; @@ -657,18 +663,18 @@ public ImmutableList reverse() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { return forwardList.contains(object); } @Override - public int indexOf(@CheckForNull @UnknownSignedness Object object) { + public int indexOf(@CheckForNull @UnknownSignedness @Readonly Object object) { int index = forwardList.lastIndexOf(object); return (index >= 0) ? reverseIndex(index) : -1; } @Override - public int lastIndexOf(@CheckForNull @UnknownSignedness Object object) { + public int lastIndexOf(@CheckForNull @UnknownSignedness @Readonly Object object) { int index = forwardList.indexOf(object); return (index >= 0) ? reverseIndex(index) : -1; } @@ -697,12 +703,12 @@ boolean isPartialView() { } @Override - public boolean equals(@CheckForNull @UnknownSignedness Object obj) { + public boolean equals(@CheckForNull @UnknownSignedness @Readonly Object obj) { return Lists.equalsImpl(this, obj); } @Override - public int hashCode(@UnknownSignedness ImmutableList this) { + public int hashCode(@UnknownSignedness @Readonly ImmutableList this) { int hashCode = 1; int n = size(); for (int i = 0; i < n; i++) { @@ -719,9 +725,9 @@ public int hashCode(@UnknownSignedness ImmutableList this) { * implementation types do not leak into the serialized representation. */ static class SerializedForm implements Serializable { - final Object[] elements; + final Object @Readonly [] elements; - SerializedForm(Object[] elements) { + SerializedForm(Object @Readonly [] elements) { this.elements = elements; } @@ -789,7 +795,7 @@ public static Builder builderWithExpectedSize(int expectedSize) { */ public static final class Builder extends ImmutableCollection.Builder { // The first `size` elements are non-null. - @VisibleForTesting @Nullable Object[] contents; + @VisibleForTesting @Nullable @Readonly Object[] contents; private int size; private boolean forceCopy; diff --git a/guava/src/com/google/common/collect/ImmutableListMultimap.java b/guava/src/com/google/common/collect/ImmutableListMultimap.java index 8db385eec27f..1155a69def03 100644 --- a/guava/src/com/google/common/collect/ImmutableListMultimap.java +++ b/guava/src/com/google/common/collect/ImmutableListMultimap.java @@ -37,6 +37,8 @@ import java.util.stream.Stream; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -52,7 +54,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public class ImmutableListMultimap extends ImmutableMultimap +@Immutable +public class ImmutableListMultimap extends ImmutableMultimap implements ListMultimap { /** * Returns a {@link Collector} that accumulates elements into an {@code ImmutableListMultimap} @@ -82,7 +85,7 @@ public class ImmutableListMultimap extends ImmutableMultimap * * @since 21.0 */ - public static + public static Collector> toImmutableListMultimap( Function keyFunction, Function valueFunction) { @@ -120,7 +123,7 @@ public class ImmutableListMultimap extends ImmutableMultimap * * @since 21.0 */ - public static + public static Collector> flatteningToImmutableListMultimap( Function keyFunction, Function> valuesFunction) { @@ -134,19 +137,19 @@ public class ImmutableListMultimap extends ImmutableMultimap */ // Casting is safe because the multimap will never hold any elements. @SuppressWarnings("unchecked") - public static ImmutableListMultimap of() { + public static ImmutableListMultimap of() { return (ImmutableListMultimap) EmptyImmutableListMultimap.INSTANCE; } /** Returns an immutable multimap containing a single entry. */ - public static ImmutableListMultimap of(K k1, V v1) { + public static ImmutableListMultimap of(K k1, V v1) { ImmutableListMultimap.Builder builder = ImmutableListMultimap.builder(); builder.put(k1, v1); return builder.build(); } /** Returns an immutable multimap containing the given entries, in order. */ - public static ImmutableListMultimap of(K k1, V v1, K k2, V v2) { + public static ImmutableListMultimap of(K k1, V v1, K k2, V v2) { ImmutableListMultimap.Builder builder = ImmutableListMultimap.builder(); builder.put(k1, v1); builder.put(k2, v2); @@ -154,7 +157,7 @@ public static ImmutableListMultimap of(K k1, V v1, K k2, V v2) { } /** Returns an immutable multimap containing the given entries, in order. */ - public static ImmutableListMultimap of(K k1, V v1, K k2, V v2, K k3, V v3) { + public static ImmutableListMultimap of(K k1, V v1, K k2, V v2, K k3, V v3) { ImmutableListMultimap.Builder builder = ImmutableListMultimap.builder(); builder.put(k1, v1); builder.put(k2, v2); @@ -163,7 +166,7 @@ public static ImmutableListMultimap of(K k1, V v1, K k2, V v2, K k3 } /** Returns an immutable multimap containing the given entries, in order. */ - public static ImmutableListMultimap of( + public static ImmutableListMultimap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { ImmutableListMultimap.Builder builder = ImmutableListMultimap.builder(); builder.put(k1, v1); @@ -174,7 +177,7 @@ public static ImmutableListMultimap of( } /** Returns an immutable multimap containing the given entries, in order. */ - public static ImmutableListMultimap of( + public static ImmutableListMultimap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) { ImmutableListMultimap.Builder builder = ImmutableListMultimap.builder(); builder.put(k1, v1); @@ -191,7 +194,7 @@ public static ImmutableListMultimap of( * Returns a new builder. The generated builder is equivalent to the builder created by the {@link * Builder} constructor. */ - public static Builder builder() { + public static Builder builder() { return new Builder<>(); } @@ -214,7 +217,7 @@ public static Builder builder() { * * @since 2.0 */ - public static final class Builder extends ImmutableMultimap.Builder { + public static final @Mutable class Builder extends ImmutableMultimap.Builder { /** * Creates a new builder. The returned builder is equivalent to the builder generated by {@link * ImmutableListMultimap#builder}. @@ -323,7 +326,7 @@ public ImmutableListMultimap build() { * * @throws NullPointerException if any key or value in {@code multimap} is null */ - public static ImmutableListMultimap copyOf( + public static ImmutableListMultimap copyOf( Multimap multimap) { if (multimap.isEmpty()) { return of(); @@ -350,13 +353,13 @@ public static ImmutableListMultimap copyOf( * @since 19.0 */ @Beta - public static ImmutableListMultimap copyOf( + public static ImmutableListMultimap copyOf( Iterable> entries) { return new Builder().putAll(entries).build(); } /** Creates an ImmutableListMultimap from an asMap.entrySet. */ - static ImmutableListMultimap fromMapEntries( + static ImmutableListMultimap fromMapEntries( Collection>> mapEntries, @Nullable Comparator valueComparator) { if (mapEntries.isEmpty()) { @@ -472,7 +475,7 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo if (keyCount < 0) { throw new InvalidObjectException("Invalid key count " + keyCount); } - ImmutableMap.Builder> builder = ImmutableMap.builder(); + ImmutableMap.Builder<@Immutable Object, ImmutableList> builder = ImmutableMap.builder(); int tmpSize = 0; for (int i = 0; i < keyCount; i++) { @@ -490,7 +493,7 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo tmpSize += valueCount; } - ImmutableMap> tmpMap; + ImmutableMap<@Immutable Object, ImmutableList> tmpMap; try { tmpMap = builder.buildOrThrow(); } catch (IllegalArgumentException e) { diff --git a/guava/src/com/google/common/collect/ImmutableMap.java b/guava/src/com/google/common/collect/ImmutableMap.java index f827546e1a1c..1baa0c580295 100644 --- a/guava/src/com/google/common/collect/ImmutableMap.java +++ b/guava/src/com/google/common/collect/ImmutableMap.java @@ -57,10 +57,15 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * A {@link Map} whose contents will never change, with many other important properties detailed at @@ -78,7 +83,9 @@ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization @ElementTypesAreNonnullByDefault -public abstract class ImmutableMap implements Map, Serializable { +@CFComment("Aosen: V is also immutable because it is used in multimap later") +@Immutable +public abstract class ImmutableMap implements Map, Serializable { /** * Returns a {@link Collector} that accumulates elements into an {@code ImmutableMap} whose keys @@ -92,7 +99,7 @@ public abstract class ImmutableMap implements Map, Serializable { * * @since 21.0 */ - public static + public static Collector> toImmutableMap( Function keyFunction, Function valueFunction) { @@ -109,7 +116,7 @@ public abstract class ImmutableMap implements Map, Serializable { * * @since 21.0 */ - public static + public static Collector> toImmutableMap( Function keyFunction, Function valueFunction, @@ -125,7 +132,7 @@ public abstract class ImmutableMap implements Map, Serializable { *

Performance note: the instance returned is a singleton. */ @SuppressWarnings("unchecked") - public static ImmutableMap of() { + public static ImmutableMap of() { return (ImmutableMap) RegularImmutableMap.EMPTY; } @@ -134,7 +141,7 @@ public static ImmutableMap of() { * {@link Collections#singletonMap} but will not accept a null key or value. It is preferable * mainly for consistency and maintainability of your code. */ - public static ImmutableMap of(K k1, V v1) { + public static ImmutableMap of(K k1, V v1) { return ImmutableBiMap.of(k1, v1); } @@ -143,7 +150,7 @@ public static ImmutableMap of(K k1, V v1) { * * @throws IllegalArgumentException if duplicate keys are provided */ - public static ImmutableMap of(K k1, V v1, K k2, V v2) { + public static ImmutableMap of(K k1, V v1, K k2, V v2) { return RegularImmutableMap.fromEntries(entryOf(k1, v1), entryOf(k2, v2)); } @@ -152,7 +159,7 @@ public static ImmutableMap of(K k1, V v1, K k2, V v2) { * * @throws IllegalArgumentException if duplicate keys are provided */ - public static ImmutableMap of(K k1, V v1, K k2, V v2, K k3, V v3) { + public static ImmutableMap of(K k1, V v1, K k2, V v2, K k3, V v3) { return RegularImmutableMap.fromEntries(entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3)); } @@ -161,7 +168,7 @@ public static ImmutableMap of(K k1, V v1, K k2, V v2, K k3, V v3) { * * @throws IllegalArgumentException if duplicate keys are provided */ - public static ImmutableMap of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { + public static ImmutableMap of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { return RegularImmutableMap.fromEntries( entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3), entryOf(k4, v4)); } @@ -171,7 +178,7 @@ public static ImmutableMap of(K k1, V v1, K k2, V v2, K k3, V v3, K * * @throws IllegalArgumentException if duplicate keys are provided */ - public static ImmutableMap of( + public static ImmutableMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) { return RegularImmutableMap.fromEntries( entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3), entryOf(k4, v4), entryOf(k5, v5)); @@ -183,7 +190,7 @@ public static ImmutableMap of( * @throws IllegalArgumentException if duplicate keys are provided * @since 31.0 */ - public static ImmutableMap of( + public static ImmutableMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) { return RegularImmutableMap.fromEntries( entryOf(k1, v1), @@ -200,7 +207,7 @@ public static ImmutableMap of( * @throws IllegalArgumentException if duplicate keys are provided * @since 31.0 */ - public static ImmutableMap of( + public static ImmutableMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) { return RegularImmutableMap.fromEntries( entryOf(k1, v1), @@ -218,7 +225,7 @@ public static ImmutableMap of( * @throws IllegalArgumentException if duplicate keys are provided * @since 31.0 */ - public static ImmutableMap of( + public static ImmutableMap of( K k1, V v1, K k2, @@ -252,7 +259,7 @@ public static ImmutableMap of( * @throws IllegalArgumentException if duplicate keys are provided * @since 31.0 */ - public static ImmutableMap of( + public static ImmutableMap of( K k1, V v1, K k2, @@ -289,7 +296,7 @@ public static ImmutableMap of( * @throws IllegalArgumentException if duplicate keys are provided * @since 31.0 */ - public static ImmutableMap of( + public static ImmutableMap of( K k1, V v1, K k2, @@ -332,7 +339,7 @@ public static ImmutableMap of( * @since 31.0 */ @SafeVarargs - public static ImmutableMap ofEntries(Entry... entries) { + public static ImmutableMap ofEntries(Entry... entries) { @SuppressWarnings("unchecked") // we will only ever read these Entry[] entries2 = (Entry[]) entries; return RegularImmutableMap.fromEntries(entries2); @@ -345,7 +352,7 @@ public static ImmutableMap ofEntries(EntryA call to {@link Entry#setValue} on the returned entry will always throw {@link * UnsupportedOperationException}. */ - static Entry entryOf(K key, V value) { + static @Immutable Entry entryOf(K key, V value) { return new ImmutableMapEntry<>(key, value); } @@ -353,7 +360,7 @@ static Entry entryOf(K key, V value) { * Returns a new builder. The generated builder is equivalent to the builder created by the {@link * Builder} constructor. */ - public static Builder builder() { + public static Builder builder() { return new Builder<>(); } @@ -370,20 +377,20 @@ public static Builder builder() { * @since 23.1 */ @Beta - public static Builder builderWithExpectedSize(int expectedSize) { + public static Builder builderWithExpectedSize(int expectedSize) { checkNonnegative(expectedSize, "expectedSize"); return new Builder<>(expectedSize); } static void checkNoConflict( - boolean safe, String conflictDescription, Object entry1, Object entry2) { + boolean safe, String conflictDescription, @Readonly Object entry1, @Readonly Object entry2) { if (!safe) { throw conflictException(conflictDescription, entry1, entry2); } } static IllegalArgumentException conflictException( - String conflictDescription, Object entry1, Object entry2) { + String conflictDescription, @Readonly Object entry1, @Readonly Object entry2) { return new IllegalArgumentException( "Multiple entries with same " + conflictDescription + ": " + entry1 + " and " + entry2); } @@ -418,9 +425,9 @@ static IllegalArgumentException conflictException( * @since 2.0 */ @DoNotMock - public static class Builder { + public static class Builder { @CheckForNull Comparator valueComparator; - @Nullable Entry[] entries; + @Nullable @Immutable Entry[] entries; int size; boolean entriesUsed; @@ -434,7 +441,7 @@ public Builder() { @SuppressWarnings({"unchecked", "rawtypes"}) Builder(int initialCapacity) { - this.entries = new @Nullable Entry[initialCapacity]; + this.entries = new @Nullable @Immutable Entry[initialCapacity]; this.size = 0; this.entriesUsed = false; } @@ -647,8 +654,8 @@ ImmutableMap buildJdkBacked() { } } - private static Entry[] lastEntryForEachKey(Entry[] entries, int size) { - Set seen = new HashSet<>(); + private static Entry[] lastEntryForEachKey(Entry[] entries, int size) { + Set seen = new @Mutable HashSet<>(); BitSet dups = new BitSet(); // slots that are overridden by a later duplicate key for (int i = size - 1; i >= 0; i--) { if (!seen.add(entries[i].getKey())) { @@ -681,7 +688,7 @@ private static Entry[] lastEntryForEachKey(Entry[] entries, i * * @throws NullPointerException if any key or value in {@code map} is null */ - public static ImmutableMap copyOf(Map map) { + public static ImmutableMap copyOf(Map map) { if ((map instanceof ImmutableMap) && !(map instanceof SortedMap)) { @SuppressWarnings("unchecked") // safe since map is not writable ImmutableMap kvMap = (ImmutableMap) map; @@ -705,7 +712,7 @@ public static ImmutableMap copyOf(Map map * @since 19.0 */ @Beta - public static ImmutableMap copyOf( + public static ImmutableMap copyOf( Iterable> entries) { @SuppressWarnings("unchecked") // we'll only be using getKey and getValue, which are covariant Entry[] entryArray = (Entry[]) Iterables.toArray(entries, EMPTY_ENTRY_ARRAY); @@ -736,7 +743,8 @@ private static , V> ImmutableMap copyOfEnumMap( static final Entry[] EMPTY_ENTRY_ARRAY = new Entry[0]; - abstract static class IteratorBasedImmutableMap extends ImmutableMap { + @Immutable + abstract static class IteratorBasedImmutableMap extends ImmutableMap { abstract UnmodifiableIterator> entryIterator(); Spliterator> entrySpliterator() { @@ -753,6 +761,7 @@ ImmutableSet createKeySet() { @Override ImmutableSet> createEntrySet() { + @Immutable class EntrySetImpl extends ImmutableMapEntrySet { @Override ImmutableMap map() { @@ -923,7 +932,7 @@ public final void replaceAll(BiFunction funct @Override @DoNotCall("Always throws UnsupportedOperationException") @CheckForNull - public final V remove(@CheckForNull @UnknownSignedness Object o) { + public final V remove(@CheckForNull @UnknownSignedness @Readonly Object o) { throw new UnsupportedOperationException(); } @@ -936,7 +945,7 @@ public final V remove(@CheckForNull @UnknownSignedness Object o) { @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") - public final boolean remove(@CheckForNull @UnknownSignedness Object key, @CheckForNull @UnknownSignedness Object value) { + public final boolean remove(@CheckForNull @UnknownSignedness @Readonly Object key, @CheckForNull @UnknownSignedness @Readonly Object value) { throw new UnsupportedOperationException(); } @@ -961,20 +970,20 @@ public boolean isEmpty() { @Pure @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return get(key) != null; } @Pure @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@CheckForNull @UnknownSignedness @Readonly Object value) { return values().contains(value); } // Overriding to mark it Nullable @Override @CheckForNull - public abstract V get(@CheckForNull @UnknownSignedness Object key); + public abstract V get(@CheckForNull @UnknownSignedness @Readonly Object key); /** * @since 21.0 (but only since 23.5 in the Android > entrySet; + @CFComment("Change to @LazyFinal later") + @LazyInit @RetainedWith @CheckForNull private transient @Assignable ImmutableSet> entrySet; /** * Returns an immutable set of the mappings in this map. The iteration order is specified by the @@ -1033,7 +1043,8 @@ public final V getOrDefault(@CheckForNull @UnknownSignedness Object key, @CheckF abstract ImmutableSet> createEntrySet(); - @LazyInit @RetainedWith @CheckForNull private transient ImmutableSet keySet; + @CFComment("Change to @LazyFinal later") + @LazyInit @RetainedWith @CheckForNull private transient @Assignable ImmutableSet keySet; /** * Returns an immutable set of the keys in this map, in the same order that they appear in {@link @@ -1072,7 +1083,7 @@ Spliterator keySpliterator() { return CollectSpliterators.map(entrySet().spliterator(), Entry::getKey); } - @LazyInit @RetainedWith @CheckForNull private transient ImmutableCollection values; + @LazyInit @RetainedWith @CheckForNull private transient @Assignable ImmutableCollection values; /** * Returns an immutable collection of the values in this map, in the same order that they appear @@ -1093,18 +1104,19 @@ public ImmutableCollection values() { abstract ImmutableCollection createValues(); // cached so that this.multimapView().inverse() only computes inverse once - @LazyInit @CheckForNull private transient ImmutableSetMultimap multimapView; + @CFComment("Change to @LazyFinal later") + @LazyInit @CheckForNull private transient ImmutableSetMultimap multimapView; /** * Returns a multimap view of the map. * * @since 14.0 */ - public ImmutableSetMultimap asMultimap() { + public ImmutableSetMultimap asMultimap() { if (isEmpty()) { return ImmutableSetMultimap.of(); } - ImmutableSetMultimap result = multimapView; + ImmutableSetMultimap result = multimapView; return (result == null) ? (multimapView = new ImmutableSetMultimap<>(new MapViewOfValuesAsSingletonSets(), size(), null)) @@ -1112,6 +1124,7 @@ public ImmutableSetMultimap asMultimap() { } @WeakOuter + @Immutable private final class MapViewOfValuesAsSingletonSets extends IteratorBasedImmutableMap> { @@ -1126,13 +1139,13 @@ ImmutableSet createKeySet() { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return ImmutableMap.this.containsKey(key); } @Override @CheckForNull - public ImmutableSet get(@CheckForNull @UnknownSignedness Object key) { + public ImmutableSet get(@CheckForNull @UnknownSignedness @Readonly Object key) { V outerValue = ImmutableMap.this.get(key); return (outerValue == null) ? null : ImmutableSet.of(outerValue); } @@ -1183,7 +1196,7 @@ public ImmutableSet getValue() { @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@CheckForNull @Readonly Object object) { return Maps.equalsImpl(this, object); } @@ -1210,7 +1223,7 @@ public String toString() { * reconstructed using public factory methods. This ensures that the implementation types remain * as implementation details. */ - static class SerializedForm implements Serializable { + static class SerializedForm implements Serializable { // This object retains references to collections returned by keySet() and value(). This saves // bytes when the both the map and its keySet or value collection are written to the same // instance of ObjectOutputStream. @@ -1227,7 +1240,7 @@ static class SerializedForm implements Serializable { Object[] values = new Object[map.size()]; int i = 0; // "extends Object" works around https://github.com/typetools/checker-framework/issues/3013 - for (Entry entry : map.entrySet()) { + for (Entry entry : map.entrySet()) { keys[i] = entry.getKey(); values[i] = entry.getValue(); i++; @@ -1241,7 +1254,7 @@ static class SerializedForm implements Serializable { } @SuppressWarnings("unchecked") - final Object readResolve() { + final @Immutable Object readResolve() { if (!(this.keys instanceof ImmutableSet)) { return legacyReadResolve(); } @@ -1262,7 +1275,7 @@ final Object readResolve() { } @SuppressWarnings("unchecked") - final Object legacyReadResolve() { + final @Immutable Object legacyReadResolve() { K[] keys = (K[]) this.keys; V[] values = (V[]) this.values; diff --git a/guava/src/com/google/common/collect/ImmutableMapEntry.java b/guava/src/com/google/common/collect/ImmutableMapEntry.java index ac483d8fd8ee..9a38712d72fa 100644 --- a/guava/src/com/google/common/collect/ImmutableMapEntry.java +++ b/guava/src/com/google/common/collect/ImmutableMapEntry.java @@ -20,6 +20,8 @@ import com.google.common.annotations.GwtIncompatible; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Implementation of {@code Entry} for {@link ImmutableMap} that adds extra methods to traverse hash @@ -32,9 +34,11 @@ * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtIncompatible // unnecessary @ElementTypesAreNonnullByDefault -class ImmutableMapEntry extends ImmutableEntry { +@Immutable +class ImmutableMapEntry extends ImmutableEntry { /** * Creates an {@code ImmutableMapEntry} array to hold parameterized entries. The result must never * be upcast back to ImmutableMapEntry[] (or Object[], etc.), or allowed to escape the class. @@ -77,7 +81,8 @@ boolean isReusable() { return true; } - static class NonTerminalImmutableMapEntry extends ImmutableMapEntry { + @Immutable + static class NonTerminalImmutableMapEntry extends ImmutableMapEntry { /* * Yes, we sometimes set nextInKeyBucket to null, even for this "non-terminal" entry. We don't * do that with a plain NonTerminalImmutableMapEntry, but we do do it with the BiMap-specific @@ -104,7 +109,8 @@ final boolean isReusable() { } } - static final class NonTerminalImmutableBiMapEntry + @Immutable + static final class NonTerminalImmutableBiMapEntry extends NonTerminalImmutableMapEntry { @CheckForNull private final transient ImmutableMapEntry nextInValueBucket; diff --git a/guava/src/com/google/common/collect/ImmutableMapEntrySet.java b/guava/src/com/google/common/collect/ImmutableMapEntrySet.java index fec6d1525a6d..0b62ca7223d0 100644 --- a/guava/src/com/google/common/collect/ImmutableMapEntrySet.java +++ b/guava/src/com/google/common/collect/ImmutableMapEntrySet.java @@ -25,6 +25,8 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -35,16 +37,18 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -abstract class ImmutableMapEntrySet extends ImmutableSet.CachingAsList> { - static final class RegularEntrySet extends ImmutableMapEntrySet { +@Immutable +abstract class ImmutableMapEntrySet extends ImmutableSet.CachingAsList> { + @Immutable + static final class RegularEntrySet extends ImmutableMapEntrySet { private final transient ImmutableMap map; - private final transient ImmutableList> entries; + private final transient ImmutableList<@Immutable Entry> entries; - RegularEntrySet(ImmutableMap map, Entry[] entries) { + RegularEntrySet(ImmutableMap map, @Immutable Entry[] entries) { this(map, ImmutableList.>asImmutableList(entries)); } - RegularEntrySet(ImmutableMap map, ImmutableList> entries) { + RegularEntrySet(ImmutableMap map, ImmutableList<@Immutable Entry> entries) { this.map = map; this.entries = entries; } @@ -91,7 +95,7 @@ ImmutableList> createAsList() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { if (object instanceof Entry) { Entry entry = (Entry) object; V value = map().get(entry.getKey()); @@ -123,14 +127,14 @@ Object writeReplace() { } @GwtIncompatible // serialization - private static class EntrySetSerializedForm implements Serializable { + private static class EntrySetSerializedForm implements Serializable { final ImmutableMap map; EntrySetSerializedForm(ImmutableMap map) { this.map = map; } - Object readResolve() { + @Immutable Object readResolve() { return map.entrySet(); } diff --git a/guava/src/com/google/common/collect/ImmutableMapKeySet.java b/guava/src/com/google/common/collect/ImmutableMapKeySet.java index ef845fdf3529..6ea3f87d3b71 100644 --- a/guava/src/com/google/common/collect/ImmutableMapKeySet.java +++ b/guava/src/com/google/common/collect/ImmutableMapKeySet.java @@ -25,6 +25,7 @@ import java.util.function.Consumer; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -35,7 +36,8 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -final class ImmutableMapKeySet extends IndexedImmutableSet { +@Immutable +final class ImmutableMapKeySet extends IndexedImmutableSet { private final ImmutableMap map; ImmutableMapKeySet(ImmutableMap map) { @@ -81,7 +83,7 @@ boolean isPartialView() { // No longer used for new writes, but kept so that old data can still be read. @GwtIncompatible // serialization @SuppressWarnings("unused") - private static class KeySetSerializedForm implements Serializable { + private static class KeySetSerializedForm implements Serializable { final ImmutableMap map; KeySetSerializedForm(ImmutableMap map) { diff --git a/guava/src/com/google/common/collect/ImmutableMapValues.java b/guava/src/com/google/common/collect/ImmutableMapValues.java index cfa905e7d2ea..73d9a7da469b 100644 --- a/guava/src/com/google/common/collect/ImmutableMapValues.java +++ b/guava/src/com/google/common/collect/ImmutableMapValues.java @@ -26,7 +26,10 @@ import java.util.function.Consumer; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * {@code values()} implementation for {@link ImmutableMap}. @@ -34,9 +37,11 @@ * @author Jesse Wilson * @author Kevin Bourrillion */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -final class ImmutableMapValues extends ImmutableCollection { +@Immutable +final class ImmutableMapValues extends ImmutableCollection { private final ImmutableMap map; ImmutableMapValues(ImmutableMap map) { @@ -49,7 +54,7 @@ final class ImmutableMapValues extends ImmutableCollection { } @Override - public UnmodifiableIterator iterator() { + public @Readonly UnmodifiableIterator iterator() { return new UnmodifiableIterator() { final UnmodifiableIterator> entryItr = map.entrySet().iterator(); @@ -71,7 +76,7 @@ public Spliterator spliterator() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { return object != null && Iterators.contains(iterator(), object); } @@ -113,7 +118,7 @@ private static class SerializedForm implements Serializable { this.map = map; } - Object readResolve() { + @Immutable Object readResolve() { return map.values(); } diff --git a/guava/src/com/google/common/collect/ImmutableMultimap.java b/guava/src/com/google/common/collect/ImmutableMultimap.java index 12eec7742bf8..6b665f2accd3 100644 --- a/guava/src/com/google/common/collect/ImmutableMultimap.java +++ b/guava/src/com/google/common/collect/ImmutableMultimap.java @@ -43,6 +43,9 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -74,10 +77,11 @@ * @author Jared Levy * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -public abstract class ImmutableMultimap extends BaseImmutableMultimap +@Immutable +public abstract class ImmutableMultimap extends BaseImmutableMultimap implements Serializable { /** @@ -85,17 +89,17 @@ public abstract class ImmutableMultimap extends BaseImmutableMultimapPerformance note: the instance returned is a singleton. */ - public static ImmutableMultimap of() { + public static ImmutableMultimap of() { return ImmutableListMultimap.of(); } /** Returns an immutable multimap containing a single entry. */ - public static ImmutableMultimap of(K k1, V v1) { + public static ImmutableMultimap of(K k1, V v1) { return ImmutableListMultimap.of(k1, v1); } /** Returns an immutable multimap containing the given entries, in order. */ - public static ImmutableMultimap of(K k1, V v1, K k2, V v2) { + public static ImmutableMultimap of(K k1, V v1, K k2, V v2) { return ImmutableListMultimap.of(k1, v1, k2, v2); } @@ -103,7 +107,7 @@ public static ImmutableMultimap of(K k1, V v1, K k2, V v2) { * Returns an immutable multimap containing the given entries, in the "key-grouped" insertion * order described in the class documentation. */ - public static ImmutableMultimap of(K k1, V v1, K k2, V v2, K k3, V v3) { + public static ImmutableMultimap of(K k1, V v1, K k2, V v2, K k3, V v3) { return ImmutableListMultimap.of(k1, v1, k2, v2, k3, v3); } @@ -111,7 +115,7 @@ public static ImmutableMultimap of(K k1, V v1, K k2, V v2, K k3, V * Returns an immutable multimap containing the given entries, in the "key-grouped" insertion * order described in the class documentation. */ - public static ImmutableMultimap of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { + public static ImmutableMultimap of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { return ImmutableListMultimap.of(k1, v1, k2, v2, k3, v3, k4, v4); } @@ -119,7 +123,7 @@ public static ImmutableMultimap of(K k1, V v1, K k2, V v2, K k3, V * Returns an immutable multimap containing the given entries, in the "key-grouped" insertion * order described in the class documentation. */ - public static ImmutableMultimap of( + public static ImmutableMultimap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) { return ImmutableListMultimap.of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5); } @@ -130,7 +134,7 @@ public static ImmutableMultimap of( * Returns a new builder. The generated builder is equivalent to the builder created by the {@link * Builder} constructor. */ - public static Builder builder() { + public static Builder builder() { return new Builder<>(); } @@ -154,7 +158,7 @@ public static Builder builder() { * @since 2.0 */ @DoNotMock - public static class Builder { + public static class Builder { final Map> builderMap; @CheckForNull Comparator keyComparator; @CheckForNull Comparator valueComparator; @@ -189,7 +193,7 @@ public Builder put(K key, V value) { * @since 11.0 */ @CanIgnoreReturnValue - public Builder put(Entry entry) { + public Builder put(@Readonly Entry entry) { return put(entry.getKey(), entry.getValue()); } @@ -260,8 +264,8 @@ public Builder putAll(K key, V... values) { * left in an invalid state. */ @CanIgnoreReturnValue - public Builder putAll(Multimap multimap) { - for (Entry> entry : + public Builder putAll(@Readonly Multimap multimap) { + for (Entry> entry : multimap.asMap().entrySet()) { putAll(entry.getKey(), entry.getValue()); } @@ -318,7 +322,7 @@ public ImmutableMultimap build() { * * @throws NullPointerException if any key or value in {@code multimap} is null */ - public static ImmutableMultimap copyOf(Multimap multimap) { + public static ImmutableMultimap copyOf(Multimap multimap) { if (multimap instanceof ImmutableMultimap) { @SuppressWarnings("unchecked") // safe since multimap is not writable ImmutableMultimap kvMultimap = (ImmutableMultimap) multimap; @@ -338,7 +342,7 @@ public static ImmutableMultimap copyOf(Multimap ImmutableMultimap copyOf( + public static ImmutableMultimap copyOf( Iterable> entries) { return ImmutableListMultimap.copyOf(entries); } @@ -377,7 +381,7 @@ static class FieldSettersHolder { // DoNotCall wants this to be final, but we want to override it to return more specific types. // Inheritance is closed, and all subtypes are @DoNotCall, so this is safe to suppress. @SuppressWarnings("DoNotCall") - public ImmutableCollection removeAll(@CheckForNull Object key) { + public ImmutableCollection removeAll(@CheckForNull @Readonly Object key) { throw new UnsupportedOperationException(); } @@ -465,7 +469,7 @@ public final boolean putAll(K key, Iterable values) { @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") - public final boolean putAll(Multimap multimap) { + public final boolean putAll(@Readonly Multimap multimap) { throw new UnsupportedOperationException(); } @@ -479,7 +483,7 @@ public final boolean putAll(Multimap multimap) { @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") - public final boolean remove(@CheckForNull Object key, @CheckForNull Object value) { + public final boolean remove(@CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { throw new UnsupportedOperationException(); } @@ -497,13 +501,13 @@ boolean isPartialView() { @Pure @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return map.containsKey(key); } @Pure @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@CheckForNull @UnknownSignedness @Readonly Object value) { return value != null && super.containsValue(value); } @@ -536,7 +540,7 @@ Set createKeySet() { */ @Override @SuppressWarnings("unchecked") // a widening cast - public ImmutableMap> asMap() { + public ImmutableMap> asMap() { return (ImmutableMap) map; } @@ -548,16 +552,17 @@ Map> createAsMap() { /** Returns an immutable collection of all key-value pairs in the multimap. */ @SideEffectFree @Override - public ImmutableCollection> entries() { - return (ImmutableCollection>) super.entries(); + public ImmutableCollection<@Immutable Entry> entries() { + return (ImmutableCollection<@Immutable Entry>) super.entries(); } @Override - ImmutableCollection> createEntries() { + ImmutableCollection<@Immutable Entry> createEntries() { return new EntryCollection<>(this); } - private static class EntryCollection extends ImmutableCollection> { + @Immutable + private static class EntryCollection extends ImmutableCollection<@Immutable Entry> { @Weak final ImmutableMultimap multimap; EntryCollection(ImmutableMultimap multimap) { @@ -565,7 +570,7 @@ private static class EntryCollection extends ImmutableCollection> iterator() { + public UnmodifiableIterator<@Immutable Entry> iterator() { return multimap.entryIterator(); } @@ -582,9 +587,9 @@ boolean isPartialView() { @Pure @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { if (object instanceof Entry) { - Entry entry = (Entry) object; + Entry entry = (@Immutable Entry) object; return multimap.containsEntry(entry.getKey(), entry.getValue()); } return false; @@ -594,9 +599,9 @@ public boolean contains(@CheckForNull @UnknownSignedness Object object) { } @Override - UnmodifiableIterator> entryIterator() { - return new UnmodifiableIterator>() { - final Iterator>> asMapItr = + UnmodifiableIterator<@Immutable Entry> entryIterator() { + return new UnmodifiableIterator<@Immutable Entry>() { + final Iterator>> asMapItr = map.entrySet().iterator(); @CheckForNull K currentKey = null; Iterator valueItr = Iterators.emptyIterator(); @@ -607,7 +612,7 @@ public boolean hasNext() { } @Override - public Entry next() { + public @Immutable Entry next() { if (!valueItr.hasNext()) { Entry> entry = asMapItr.next(); currentKey = entry.getKey(); @@ -623,7 +628,7 @@ public Entry next() { } @Override - Spliterator> entrySpliterator() { + Spliterator<@Immutable Entry> entrySpliterator() { return CollectSpliterators.flatMap( asMap().entrySet().spliterator(), keyToValueCollectionEntry -> { @@ -661,14 +666,15 @@ ImmutableMultiset createKeys() { @SuppressWarnings("serial") // Uses writeReplace, not default serialization @WeakOuter + @Immutable class Keys extends ImmutableMultiset { @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { return containsKey(object); } @Override - public @NonNegative int count(@CheckForNull @UnknownSignedness Object element) { + public @NonNegative int count(@CheckForNull @UnknownSignedness @Readonly Object element) { Collection values = map.get(element); return (values == null) ? 0 : values.size(); } @@ -684,7 +690,7 @@ public ImmutableSet elementSet() { } @Override - Multiset.Entry getEntry(int index) { + Multiset.@Immutable Entry getEntry(int index) { Map.Entry> entry = map.entrySet().asList().get(index); return Multisets.immutableEntry(entry.getKey(), entry.getValue().size()); } @@ -709,7 +715,7 @@ private static final class KeysSerializedForm implements Serializable { this.multimap = multimap; } - Object readResolve() { + @Immutable Object readResolve() { return multimap.keys(); } } @@ -750,7 +756,8 @@ public V next() { }; } - private static final class Values extends ImmutableCollection { + @Immutable + private static final class Values extends ImmutableCollection { @Weak private final transient ImmutableMultimap multimap; Values(ImmutableMultimap multimap) { @@ -758,7 +765,7 @@ private static final class Values extends ImmutableCollection { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { return multimap.containsValue(object); } @@ -792,7 +799,7 @@ boolean isPartialView() { private static final long serialVersionUID = 0; -public boolean containsEntry(@Nullable Object arg0, @Nullable Object arg1) { return super.containsEntry(arg0, arg1); } +public boolean containsEntry(@Nullable @Readonly Object arg0, @Nullable @Readonly Object arg1) { return super.containsEntry(arg0, arg1); } -public boolean equals(@Nullable Object arg0) { return super.equals(arg0); } +public boolean equals(@Nullable @Readonly Object arg0) { return super.equals(arg0); } } diff --git a/guava/src/com/google/common/collect/ImmutableMultiset.java b/guava/src/com/google/common/collect/ImmutableMultiset.java index 001c0e72764d..2f80865a0ef4 100644 --- a/guava/src/com/google/common/collect/ImmutableMultiset.java +++ b/guava/src/com/google/common/collect/ImmutableMultiset.java @@ -38,10 +38,13 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * A {@link Multiset} whose contents will never change, with many other important properties @@ -62,6 +65,7 @@ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization @ElementTypesAreNonnullByDefault +@Immutable public abstract class ImmutableMultiset extends ImmutableMultisetGwtSerializationDependencies implements Multiset { @@ -378,6 +382,7 @@ private ImmutableSet> createEntrySet() { abstract Entry getEntry(int index); @WeakOuter + @Immutable private final class EntrySet extends IndexedImmutableSet> { @Override boolean isPartialView() { @@ -470,15 +475,16 @@ public static Builder builder() { * * @since 2.0 */ - public static class Builder extends ImmutableCollection.Builder { + public static @Mutable class Builder extends ImmutableCollection.Builder { final Multiset contents; /** * Creates a new builder. The returned builder is equivalent to the builder generated by {@link * ImmutableMultiset#builder}. */ + @CFComment("Annotation on static method's type argument") public Builder() { - this(LinkedHashMultiset.create()); + this(LinkedHashMultiset.<@Immutable E>create()); } Builder(Multiset contents) { @@ -591,12 +597,13 @@ public ImmutableMultiset build() { @VisibleForTesting ImmutableMultiset buildJdkBacked() { if (contents.isEmpty()) { - return of(); + return ImmutableMultiset.of(); } return JdkBackedImmutableMultiset.create(contents.entrySet()); } } + @Immutable static final class ElementSet extends ImmutableSet.Indexed { private final List> entries; // TODO(cpovirk): @Weak? @@ -646,7 +653,7 @@ static final class SerializedForm implements Serializable { } Object readResolve() { - LinkedHashMultiset multiset = LinkedHashMultiset.create(elements.length); + LinkedHashMultiset<@Immutable Object> multiset = LinkedHashMultiset.create(elements.length); for (int i = 0; i < elements.length; i++) { multiset.add(elements[i], counts[i]); } diff --git a/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java b/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java index 2469a188a2a6..c9ffad62a191 100644 --- a/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java +++ b/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java @@ -17,6 +17,7 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.checkerframework.checker.pico.qual.Immutable; /** * A dummy superclass to support GWT serialization of the element type of an {@link @@ -38,4 +39,5 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@Immutable abstract class ImmutableMultisetGwtSerializationDependencies extends ImmutableCollection {} diff --git a/guava/src/com/google/common/collect/ImmutableRangeMap.java b/guava/src/com/google/common/collect/ImmutableRangeMap.java index b6cc0fa8e638..d4e40eb82cfb 100644 --- a/guava/src/com/google/common/collect/ImmutableRangeMap.java +++ b/guava/src/com/google/common/collect/ImmutableRangeMap.java @@ -37,7 +37,10 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A {@link RangeMap} whose contents will never change, with many other important properties @@ -46,12 +49,14 @@ * @author Louis Wasserman * @since 14.0 */ +@AnnotatedFor("pico") @Beta @GwtIncompatible // NavigableMap @ElementTypesAreNonnullByDefault -public class ImmutableRangeMap, V> implements RangeMap, Serializable { +@Immutable +public class ImmutableRangeMap, V> implements RangeMap, Serializable { - private static final ImmutableRangeMap, Object> EMPTY = + private static final ImmutableRangeMap<@Immutable Comparable, Object> EMPTY = new ImmutableRangeMap<>(ImmutableList.>>of(), ImmutableList.of()); /** @@ -60,7 +65,7 @@ public class ImmutableRangeMap, V> implements RangeMap, V> + public static , V> Collector> toImmutableRangeMap( Function> keyFunction, Function valueFunction) { @@ -73,17 +78,17 @@ public class ImmutableRangeMap, V> implements RangeMapPerformance note: the instance returned is a singleton. */ @SuppressWarnings("unchecked") - public static , V> ImmutableRangeMap of() { + public static , V> ImmutableRangeMap of() { return (ImmutableRangeMap) EMPTY; } /** Returns an immutable range map mapping a single range to a single value. */ - public static , V> ImmutableRangeMap of(Range range, V value) { + public static , V> ImmutableRangeMap of(Range range, V value) { return new ImmutableRangeMap<>(ImmutableList.of(range), ImmutableList.of(value)); } @SuppressWarnings("unchecked") - public static , V> ImmutableRangeMap copyOf( + public static , V> ImmutableRangeMap copyOf( RangeMap rangeMap) { if (rangeMap instanceof ImmutableRangeMap) { return (ImmutableRangeMap) rangeMap; @@ -99,7 +104,7 @@ public static , V> ImmutableRangeMap copyOf( } /** Returns a new builder for an immutable range map. */ - public static , V> Builder builder() { + public static , V> Builder builder() { return new Builder<>(); } @@ -109,7 +114,7 @@ public static , V> Builder builder() { * @since 14.0 */ @DoNotMock - public static final class Builder, V> { + public static final class Builder, V> { private final List, V>> entries; public Builder() { @@ -199,7 +204,7 @@ public V get(K key) { @Override @CheckForNull - public Entry, V> getEntry(K key) { + public @Immutable Entry, V> getEntry(K key) { int index = SortedLists.binarySearch( ranges, @@ -388,12 +393,12 @@ public ImmutableRangeMap subRangeMap(Range subRange) { } @Override - public int hashCode(@UnknownSignedness ImmutableRangeMap this) { + public int hashCode(@UnknownSignedness @Readonly ImmutableRangeMap this) { return asMapOfRanges().hashCode(); } @Override - public boolean equals(@CheckForNull Object o) { + public boolean equals(@CheckForNull @Readonly Object o) { if (o instanceof RangeMap) { RangeMap rangeMap = (RangeMap) o; return asMapOfRanges().equals(rangeMap.asMapOfRanges()); diff --git a/guava/src/com/google/common/collect/ImmutableRangeSet.java b/guava/src/com/google/common/collect/ImmutableRangeSet.java index 5e87614609ba..fe1289694430 100644 --- a/guava/src/com/google/common/collect/ImmutableRangeSet.java +++ b/guava/src/com/google/common/collect/ImmutableRangeSet.java @@ -39,7 +39,11 @@ import java.util.stream.Collector; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A {@link RangeSet} whose contents will never change, with many other important properties @@ -48,10 +52,12 @@ * @author Louis Wasserman * @since 14.0 */ +@AnnotatedFor("pico") @Beta @GwtIncompatible @ElementTypesAreNonnullByDefault -public final class ImmutableRangeSet extends AbstractRangeSet +@Immutable +public final class ImmutableRangeSet extends AbstractRangeSet implements Serializable { private static final ImmutableRangeSet> EMPTY = @@ -67,7 +73,7 @@ public final class ImmutableRangeSet extends AbstractRange * * @since 23.1 */ - public static > + public static > Collector, ?, ImmutableRangeSet> toImmutableRangeSet() { return CollectCollectors.toImmutableRangeSet(); } @@ -78,7 +84,7 @@ public final class ImmutableRangeSet extends AbstractRange *

Performance note: the instance returned is a singleton. */ @SuppressWarnings("unchecked") - public static ImmutableRangeSet of() { + public static ImmutableRangeSet of() { return (ImmutableRangeSet) EMPTY; } @@ -86,7 +92,7 @@ public static ImmutableRangeSet of() { * Returns an immutable range set containing the specified single range. If {@link Range#isEmpty() * range.isEmpty()}, this is equivalent to {@link ImmutableRangeSet#of()}. */ - public static ImmutableRangeSet of(Range range) { + public static ImmutableRangeSet of(Range range) { checkNotNull(range); if (range.isEmpty()) { return of(); @@ -99,12 +105,12 @@ public static ImmutableRangeSet of(Range range) { /** Returns an immutable range set containing the single range {@link Range#all()}. */ @SuppressWarnings("unchecked") - static ImmutableRangeSet all() { + static ImmutableRangeSet all() { return (ImmutableRangeSet) ALL; } /** Returns an immutable copy of the specified {@code RangeSet}. */ - public static ImmutableRangeSet copyOf(RangeSet rangeSet) { + public static ImmutableRangeSet copyOf(RangeSet rangeSet) { checkNotNull(rangeSet); if (rangeSet.isEmpty()) { return of(); @@ -129,7 +135,7 @@ public static ImmutableRangeSet copyOf(RangeSet ran * @throws IllegalArgumentException if any ranges overlap or are empty * @since 21.0 */ - public static > ImmutableRangeSet copyOf(Iterable> ranges) { + public static > ImmutableRangeSet copyOf(Iterable> ranges) { return new ImmutableRangeSet.Builder().addAll(ranges).build(); } @@ -141,7 +147,7 @@ public static > ImmutableRangeSet copyOf(Iterable> ImmutableRangeSet unionOf(Iterable> ranges) { + public static > ImmutableRangeSet unionOf(Iterable> ranges) { return copyOf(TreeRangeSet.create(ranges)); } @@ -316,6 +322,7 @@ public ImmutableSet> asDescendingSetOfRanges() { @LazyInit @CheckForNull private transient ImmutableRangeSet complement; + @Immutable private final class ComplementRanges extends ImmutableList> { // True if the "positive" range set is empty or bounded below. private final boolean positiveBoundedBelow; @@ -548,6 +555,7 @@ public ImmutableSortedSet asSet(DiscreteDomain domain) { return new AsSet(domain); } + @Immutable private final class AsSet extends ImmutableSortedSet { private final DiscreteDomain domain; @@ -697,7 +705,8 @@ Object writeReplace() { } } - private static class AsSetSerializedForm implements Serializable { + @Immutable + private static class AsSetSerializedForm implements Serializable { private final ImmutableList> ranges; private final DiscreteDomain domain; @@ -722,7 +731,7 @@ boolean isPartialView() { } /** Returns a new builder for an immutable range set. */ - public static > Builder builder() { + public static > Builder builder() { return new Builder(); } @@ -731,7 +740,8 @@ public static > Builder builder() { * * @since 14.0 */ - public static class Builder> { + @Mutable + public static class Builder> { private final List> ranges; public Builder() { @@ -823,14 +833,15 @@ public ImmutableRangeSet build() { } } - private static final class SerializedForm implements Serializable { + @Immutable + private static final class SerializedForm implements Serializable { private final ImmutableList> ranges; SerializedForm(ImmutableList> ranges) { this.ranges = ranges; } - Object readResolve() { + @Immutable Object readResolve() { if (ranges.isEmpty()) { return of(); } else if (ranges.equals(ImmutableList.of(Range.all()))) { @@ -841,7 +852,7 @@ Object readResolve() { } } - Object writeReplace() { + @Immutable Object writeReplace() { return new SerializedForm(ranges); } } diff --git a/guava/src/com/google/common/collect/ImmutableSet.java b/guava/src/com/google/common/collect/ImmutableSet.java index ad804eea3b61..0c72c8ced6ad 100644 --- a/guava/src/com/google/common/collect/ImmutableSet.java +++ b/guava/src/com/google/common/collect/ImmutableSet.java @@ -44,6 +44,10 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -58,6 +62,7 @@ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization @ElementTypesAreNonnullByDefault +@Immutable public abstract class ImmutableSet extends ImmutableCollection implements Set { static final int SPLITERATOR_CHARACTERISTICS = ImmutableCollection.SPLITERATOR_CHARACTERISTICS | Spliterator.DISTINCT; @@ -144,7 +149,7 @@ public static ImmutableSet of(E e1, E e2, E e3, E e4, E e5, E e6, E... ot checkArgument( others.length <= Integer.MAX_VALUE - 6, "the total number of elements must fit in an int"); final int paramCount = 6; - Object[] elements = new Object[paramCount + others.length]; + @Readonly Object @Mutable [] elements = new Object @Mutable [paramCount + others.length]; elements[0] = e1; elements[1] = e2; elements[2] = e3; @@ -170,7 +175,7 @@ public static ImmutableSet of(E e1, E e2, E e3, E e4, E e5, E e6, E... ot * * @throws NullPointerException if any of the first {@code n} elements of {@code elements} is null */ - private static ImmutableSet constructUnknownDuplication(int n, Object... elements) { + private static ImmutableSet constructUnknownDuplication(int n, @Readonly Object... elements) { // Guess the size is "halfway between" all duplicates and no duplicates, on a log scale. return construct( n, @@ -194,7 +199,7 @@ private static ImmutableSet constructUnknownDuplication(int n, Object... * * @throws NullPointerException if any of the first {@code n} elements of {@code elements} is null */ - private static ImmutableSet construct(int n, int expectedSize, Object... elements) { + private static ImmutableSet construct(int n, int expectedSize, @Readonly Object @Readonly ... elements) { switch (n) { case 0: return of(); @@ -319,7 +324,7 @@ boolean isHashCodeFast() { @Pure @Override - public boolean equals(@CheckForNull @UnknownSignedness Object object) { + public boolean equals(@CheckForNull @UnknownSignedness @Readonly Object object) { if (object == this) { return true; } @@ -344,8 +349,9 @@ public int hashCode(@UnknownSignedness ImmutableSet this) { public abstract UnmodifiableIterator iterator(); @GwtCompatible + @Immutable abstract static class CachingAsList extends ImmutableSet { - @LazyInit @RetainedWith @CheckForNull private transient ImmutableList asList; + @LazyInit @RetainedWith @CheckForNull private transient @Assignable ImmutableList asList; @Override public ImmutableList asList() { @@ -362,6 +368,7 @@ ImmutableList createAsList() { } } + @Immutable abstract static class Indexed extends CachingAsList { abstract E get(int index); @@ -475,13 +482,13 @@ public static Builder builderWithExpectedSize(int expectedSize) { * * @since 2.0 */ - public static class Builder extends ImmutableCollection.Builder { + public static @Mutable class Builder extends ImmutableCollection.Builder { /* * `impl` is null only for instances of the subclass, ImmutableSortedSet.Builder. That subclass * overrides all the methods that access it here. Thus, all the methods here can safely assume * that this field is non-null. */ - @CheckForNull private SetBuilderImpl impl; + @CheckForNull private @Mutable SetBuilderImpl impl; boolean forceCopy; public Builder() { @@ -583,7 +590,7 @@ public ImmutableSet build() { } /** Swappable internal implementation of an ImmutableSet.Builder. */ - private abstract static class SetBuilderImpl { + private abstract static @Mutable class SetBuilderImpl { // The first `distinct` elements are non-null. // Since we can never access null elements, we don't mark this nullable. E[] dedupedElements; @@ -591,7 +598,7 @@ private abstract static class SetBuilderImpl { @SuppressWarnings("unchecked") SetBuilderImpl(int expectedCapacity) { - this.dedupedElements = (E[]) new Object[expectedCapacity]; + this.dedupedElements = (E @Mutable []) new Object[expectedCapacity]; this.distinct = 0; } @@ -655,7 +662,7 @@ SetBuilderImpl review() { abstract ImmutableSet build(); } - private static final class EmptySetBuilderImpl extends SetBuilderImpl { + private static final @Mutable class EmptySetBuilderImpl extends SetBuilderImpl { private static final EmptySetBuilderImpl INSTANCE = new EmptySetBuilderImpl<>(); @SuppressWarnings("unchecked") @@ -724,9 +731,9 @@ static int chooseTableSize(int setSize) { *

This implementation attempts to detect hash flooding, and if it's identified, falls back to * JdkBackedSetBuilderImpl. */ - private static final class RegularSetBuilderImpl extends SetBuilderImpl { + private static final @Mutable class RegularSetBuilderImpl extends SetBuilderImpl { // null until at least two elements are present - private @Nullable Object @Nullable [] hashTable; + private @Nullable @Readonly Object @Nullable [] hashTable; private int maxRunBeforeFallback; private int expandTableThreshold; private int hashCode; @@ -821,7 +828,7 @@ ImmutableSet build() { * populated. */ @SuppressWarnings("nullness") - Object[] elements = + @Readonly Object[] elements = (distinct == dedupedElements.length) ? dedupedElements : Arrays.copyOf(dedupedElements, distinct); @@ -831,8 +838,8 @@ ImmutableSet build() { } /** Builds a new open-addressed hash table from the first n objects in elements. */ - static @Nullable Object[] rebuildHashTable(int newTableSize, Object[] elements, int n) { - @Nullable Object[] hashTable = new @Nullable Object[newTableSize]; + static @Nullable Object @Mutable [] rebuildHashTable(int newTableSize, Object[] elements, int n) { + @Nullable Object [] hashTable = new @Nullable Object @Mutable [newTableSize]; int mask = hashTable.length - 1; for (int i = 0; i < n; i++) { // requireNonNull is safe because we ensure that the first n elements have been populated. @@ -892,7 +899,7 @@ void ensureTableCapacity(int minCapacity) { *

This method may return {@code true} even on truly random input, but {@code * ImmutableSetTest} tests that the probability of that is low. */ - static boolean hashFloodingDetected(@Nullable Object[] hashTable) { + static boolean hashFloodingDetected(@Nullable Object @Mutable [] hashTable) { int maxRunBeforeFallback = maxRunBeforeFallback(hashTable.length); int mask = hashTable.length - 1; @@ -943,8 +950,8 @@ static int maxRunBeforeFallback(int tableSize) { /** * SetBuilderImpl version that uses a JDK HashSet, which has built in hash flooding protection. */ - private static final class JdkBackedSetBuilderImpl extends SetBuilderImpl { - private final Set delegate; + private static final @Mutable class JdkBackedSetBuilderImpl extends SetBuilderImpl { + private final Set<@Readonly Object> delegate; JdkBackedSetBuilderImpl(SetBuilderImpl toCopy) { super(toCopy); // initializes dedupedElements and distinct diff --git a/guava/src/com/google/common/collect/ImmutableSetMultimap.java b/guava/src/com/google/common/collect/ImmutableSetMultimap.java index 9cf1ee0b5c16..b0332273876a 100644 --- a/guava/src/com/google/common/collect/ImmutableSetMultimap.java +++ b/guava/src/com/google/common/collect/ImmutableSetMultimap.java @@ -42,6 +42,9 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; @@ -63,7 +66,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public class ImmutableSetMultimap extends ImmutableMultimap +@Immutable +public class ImmutableSetMultimap extends ImmutableMultimap implements SetMultimap { /** * Returns a {@link Collector} that accumulates elements into an {@code ImmutableSetMultimap} @@ -93,7 +97,7 @@ public class ImmutableSetMultimap extends ImmutableMultimap * * @since 21.0 */ - public static + public static Collector> toImmutableSetMultimap( Function keyFunction, Function valueFunction) { @@ -140,7 +144,7 @@ public class ImmutableSetMultimap extends ImmutableMultimap * * @since 21.0 */ - public static + public static Collector> flatteningToImmutableSetMultimap( Function keyFunction, Function> valuesFunction) { @@ -154,12 +158,12 @@ public class ImmutableSetMultimap extends ImmutableMultimap */ // Casting is safe because the multimap will never hold any elements. @SuppressWarnings("unchecked") - public static ImmutableSetMultimap of() { + public static ImmutableSetMultimap of() { return (ImmutableSetMultimap) EmptyImmutableSetMultimap.INSTANCE; } /** Returns an immutable multimap containing a single entry. */ - public static ImmutableSetMultimap of(K k1, V v1) { + public static ImmutableSetMultimap of(K k1, V v1) { ImmutableSetMultimap.Builder builder = ImmutableSetMultimap.builder(); builder.put(k1, v1); return builder.build(); @@ -169,7 +173,7 @@ public static ImmutableSetMultimap of(K k1, V v1) { * Returns an immutable multimap containing the given entries, in order. Repeated occurrences of * an entry (according to {@link Object#equals}) after the first are ignored. */ - public static ImmutableSetMultimap of(K k1, V v1, K k2, V v2) { + public static ImmutableSetMultimap of(K k1, V v1, K k2, V v2) { ImmutableSetMultimap.Builder builder = ImmutableSetMultimap.builder(); builder.put(k1, v1); builder.put(k2, v2); @@ -180,7 +184,7 @@ public static ImmutableSetMultimap of(K k1, V v1, K k2, V v2) { * Returns an immutable multimap containing the given entries, in order. Repeated occurrences of * an entry (according to {@link Object#equals}) after the first are ignored. */ - public static ImmutableSetMultimap of(K k1, V v1, K k2, V v2, K k3, V v3) { + public static ImmutableSetMultimap of(K k1, V v1, K k2, V v2, K k3, V v3) { ImmutableSetMultimap.Builder builder = ImmutableSetMultimap.builder(); builder.put(k1, v1); builder.put(k2, v2); @@ -192,7 +196,7 @@ public static ImmutableSetMultimap of(K k1, V v1, K k2, V v2, K k3, * Returns an immutable multimap containing the given entries, in order. Repeated occurrences of * an entry (according to {@link Object#equals}) after the first are ignored. */ - public static ImmutableSetMultimap of( + public static ImmutableSetMultimap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { ImmutableSetMultimap.Builder builder = ImmutableSetMultimap.builder(); builder.put(k1, v1); @@ -206,7 +210,7 @@ public static ImmutableSetMultimap of( * Returns an immutable multimap containing the given entries, in order. Repeated occurrences of * an entry (according to {@link Object#equals}) after the first are ignored. */ - public static ImmutableSetMultimap of( + public static ImmutableSetMultimap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) { ImmutableSetMultimap.Builder builder = ImmutableSetMultimap.builder(); builder.put(k1, v1); @@ -220,7 +224,7 @@ public static ImmutableSetMultimap of( // looking for of() with > 5 entries? Use the builder instead. /** Returns a new {@link Builder}. */ - public static Builder builder() { + public static Builder builder() { return new Builder<>(); } @@ -243,7 +247,7 @@ public static Builder builder() { * * @since 2.0 */ - public static final class Builder extends ImmutableMultimap.Builder { + public static final @Mutable class Builder extends ImmutableMultimap.Builder { /** * Creates a new builder. The returned builder is equivalent to the builder generated by {@link * ImmutableSetMultimap#builder}. @@ -373,12 +377,12 @@ public ImmutableSetMultimap build() { * * @throws NullPointerException if any key or value in {@code multimap} is null */ - public static ImmutableSetMultimap copyOf( + public static ImmutableSetMultimap copyOf( Multimap multimap) { return copyOf(multimap, null); } - private static ImmutableSetMultimap copyOf( + private static ImmutableSetMultimap copyOf( Multimap multimap, @CheckForNull Comparator valueComparator) { checkNotNull(multimap); // eager for GWT @@ -407,13 +411,13 @@ private static ImmutableSetMultimap copyOf( * @since 19.0 */ @Beta - public static ImmutableSetMultimap copyOf( + public static ImmutableSetMultimap copyOf( Iterable> entries) { return new Builder().putAll(entries).build(); } /** Creates an ImmutableSetMultimap from an asMap.entrySet. */ - static ImmutableSetMultimap fromMapEntries( + static ImmutableSetMultimap fromMapEntries( Collection>> mapEntries, @CheckForNull Comparator valueComparator) { if (mapEntries.isEmpty()) { @@ -464,7 +468,7 @@ public ImmutableSet get(K key) { return MoreObjects.firstNonNull(set, emptySet); } - @LazyInit @RetainedWith @CheckForNull private transient ImmutableSetMultimap inverse; + @LazyInit @RetainedWith @CheckForNull private transient @Assignable ImmutableSetMultimap inverse; /** * {@inheritDoc} @@ -517,7 +521,7 @@ public final ImmutableSet replaceValues(K key, Iterable values) throw new UnsupportedOperationException(); } - @LazyInit @RetainedWith @CheckForNull private transient ImmutableSet> entries; + @LazyInit @RetainedWith @CheckForNull private transient @Assignable ImmutableSet> entries; /** * Returns an immutable collection of all key-value pairs in the multimap. Its iterator traverses @@ -530,7 +534,8 @@ public ImmutableSet> entries() { return result == null ? (entries = new EntrySet<>(this)) : result; } - private static final class EntrySet extends ImmutableSet> { + @Immutable + private static final class EntrySet extends ImmutableSet> { @Weak private final transient ImmutableSetMultimap multimap; EntrySet(ImmutableSetMultimap multimap) { @@ -616,7 +621,7 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo if (keyCount < 0) { throw new InvalidObjectException("Invalid key count " + keyCount); } - ImmutableMap.Builder> builder = ImmutableMap.builder(); + ImmutableMap.Builder<@Immutable Object, ImmutableSet> builder = ImmutableMap.builder(); int tmpSize = 0; for (int i = 0; i < keyCount; i++) { @@ -638,7 +643,7 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo tmpSize += valueCount; } - ImmutableMap> tmpMap; + ImmutableMap<@Immutable Object, ImmutableSet> tmpMap; try { tmpMap = builder.buildOrThrow(); } catch (IllegalArgumentException e) { diff --git a/guava/src/com/google/common/collect/ImmutableSortedAsList.java b/guava/src/com/google/common/collect/ImmutableSortedAsList.java index 19d6908c5dfb..69c22a5dc4e0 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedAsList.java +++ b/guava/src/com/google/common/collect/ImmutableSortedAsList.java @@ -19,7 +19,9 @@ import java.util.Comparator; import java.util.Spliterator; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * List returned by {@code ImmutableSortedSet.asList()} when the set isn't empty. @@ -27,9 +29,11 @@ * @author Jared Levy * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) @SuppressWarnings("serial") @ElementTypesAreNonnullByDefault +@Immutable final class ImmutableSortedAsList extends RegularImmutableAsList implements SortedIterable { ImmutableSortedAsList(ImmutableSortedSet backingSet, ImmutableList backingList) { diff --git a/guava/src/com/google/common/collect/ImmutableSortedMap.java b/guava/src/com/google/common/collect/ImmutableSortedMap.java index adc7e11deedd..18231ffd870c 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedMap.java +++ b/guava/src/com/google/common/collect/ImmutableSortedMap.java @@ -44,6 +44,9 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -66,10 +69,11 @@ * @author Louis Wasserman * @since 2.0 (implements {@code NavigableMap} since 12.0) */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public final class ImmutableSortedMap extends ImmutableSortedMapFauxverideShim +@Immutable +public final class ImmutableSortedMap extends ImmutableSortedMapFauxverideShim implements NavigableMap { /** * Returns a {@link Collector} that accumulates elements into an {@code ImmutableSortedMap} whose @@ -83,7 +87,7 @@ public final class ImmutableSortedMap extends ImmutableSortedMapFauxveride * * @since 21.0 */ - public static + public static Collector> toImmutableSortedMap( Comparator comparator, Function keyFunction, @@ -102,7 +106,7 @@ public final class ImmutableSortedMap extends ImmutableSortedMapFauxveride * * @since 21.0 */ - public static + public static Collector> toImmutableSortedMap( Comparator comparator, Function keyFunction, @@ -116,13 +120,13 @@ public final class ImmutableSortedMap extends ImmutableSortedMapFauxveride * TODO(kevinb): Confirm that ImmutableSortedMap is faster to construct and * uses less memory than TreeMap; then say so in the class Javadoc. */ - private static final Comparator NATURAL_ORDER = Ordering.natural(); + private static final Comparator<@Readonly Comparable> NATURAL_ORDER = Ordering.natural(); - private static final ImmutableSortedMap NATURAL_EMPTY_MAP = + private static final ImmutableSortedMap<@Immutable Comparable, @Readonly Object> NATURAL_EMPTY_MAP = new ImmutableSortedMap<>( - ImmutableSortedSet.emptySet(Ordering.natural()), ImmutableList.of()); + ImmutableSortedSet.emptySet(Ordering.natural()), ImmutableList.<@Readonly Object>of()); - static ImmutableSortedMap emptyMap(Comparator comparator) { + static ImmutableSortedMap emptyMap(Comparator comparator) { if (Ordering.natural().equals(comparator)) { return of(); } else { @@ -139,7 +143,7 @@ static ImmutableSortedMap emptyMap(Comparator comparator @SuppressWarnings("unchecked") // unsafe, comparator() returns a comparator on the specified type // TODO(kevinb): evaluate whether or not of().comparator() should return null - public static ImmutableSortedMap of() { + public static ImmutableSortedMap of() { return (ImmutableSortedMap) NATURAL_EMPTY_MAP; } @@ -149,7 +153,7 @@ public static , V> ImmutableSortedMap of(K } /** Returns an immutable map containing a single entry. */ - private static ImmutableSortedMap of(Comparator comparator, K k1, V v1) { + private static ImmutableSortedMap of(Comparator comparator, K k1, V v1) { return new ImmutableSortedMap<>( new RegularImmutableSortedSet(ImmutableList.of(k1), checkNotNull(comparator)), ImmutableList.of(v1)); @@ -174,7 +178,7 @@ public static , V> ImmutableSortedMap of( * @throws IllegalArgumentException if any two keys are equal according to their natural ordering */ @SuppressWarnings("unchecked") - public static , V> ImmutableSortedMap of( + public static , V> ImmutableSortedMap of( K k1, V v1, K k2, V v2, K k3, V v3) { return fromEntries(entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3)); } @@ -186,7 +190,7 @@ public static , V> ImmutableSortedMap of( * @throws IllegalArgumentException if any two keys are equal according to their natural ordering */ @SuppressWarnings("unchecked") - public static , V> ImmutableSortedMap of( + public static , V> ImmutableSortedMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { return fromEntries(entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3), entryOf(k4, v4)); } @@ -198,7 +202,7 @@ public static , V> ImmutableSortedMap of( * @throws IllegalArgumentException if any two keys are equal according to their natural ordering */ @SuppressWarnings("unchecked") - public static , V> ImmutableSortedMap of( + public static , V> ImmutableSortedMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) { return fromEntries( entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3), entryOf(k4, v4), entryOf(k5, v5)); @@ -212,7 +216,7 @@ public static , V> ImmutableSortedMap of( * @since 31.0 */ @SuppressWarnings("unchecked") - public static , V> ImmutableSortedMap of( + public static , V> ImmutableSortedMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) { return fromEntries( entryOf(k1, v1), @@ -231,7 +235,7 @@ public static , V> ImmutableSortedMap of( * @since 31.0 */ @SuppressWarnings("unchecked") - public static , V> ImmutableSortedMap of( + public static , V> ImmutableSortedMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) { return fromEntries( entryOf(k1, v1), @@ -251,7 +255,7 @@ public static , V> ImmutableSortedMap of( * @since 31.0 */ @SuppressWarnings("unchecked") - public static , V> ImmutableSortedMap of( + public static , V> ImmutableSortedMap of( K k1, V v1, K k2, @@ -287,7 +291,7 @@ public static , V> ImmutableSortedMap of( * @since 31.0 */ @SuppressWarnings("unchecked") - public static , V> ImmutableSortedMap of( + public static , V> ImmutableSortedMap of( K k1, V v1, K k2, @@ -326,7 +330,7 @@ public static , V> ImmutableSortedMap of( * @since 31.0 */ @SuppressWarnings("unchecked") - public static , V> ImmutableSortedMap of( + public static , V> ImmutableSortedMap of( K k1, V v1, K k2, @@ -375,7 +379,7 @@ public static , V> ImmutableSortedMap of( * @throws NullPointerException if any key or value in {@code map} is null * @throws IllegalArgumentException if any two keys are equal according to their natural ordering */ - public static ImmutableSortedMap copyOf(Map map) { + public static ImmutableSortedMap copyOf(Map map) { // Hack around K not being a subtype of Comparable. // Unsafe, see ImmutableSortedSetFauxverideShim. @SuppressWarnings("unchecked") @@ -394,7 +398,7 @@ public static ImmutableSortedMap copyOf(Map ImmutableSortedMap copyOf( + public static ImmutableSortedMap copyOf( Map map, Comparator comparator) { return copyOfInternal(map, checkNotNull(comparator)); } @@ -411,7 +415,7 @@ public static ImmutableSortedMap copyOf( * @since 19.0 */ @Beta - public static ImmutableSortedMap copyOf( + public static ImmutableSortedMap copyOf( Iterable> entries) { // Hack around K not being a subtype of Comparable. // Unsafe, see ImmutableSortedSetFauxverideShim. @@ -429,7 +433,7 @@ public static ImmutableSortedMap copyOf( * @since 19.0 */ @Beta - public static ImmutableSortedMap copyOf( + public static ImmutableSortedMap copyOf( Iterable> entries, Comparator comparator) { return fromEntries(checkNotNull(comparator), false, entries); @@ -446,7 +450,7 @@ public static ImmutableSortedMap copyOf( * @throws NullPointerException if any key or value in {@code map} is null */ @SuppressWarnings("unchecked") - public static ImmutableSortedMap copyOfSorted(SortedMap map) { + public static ImmutableSortedMap copyOfSorted(SortedMap map) { Comparator comparator = map.comparator(); if (comparator == null) { // If map has a null comparator, the keys should have a natural ordering, @@ -465,7 +469,7 @@ public static ImmutableSortedMap copyOfSorted(SortedMap ImmutableSortedMap copyOfInternal( + private static ImmutableSortedMap copyOfInternal( Map map, Comparator comparator) { boolean sameComparator = false; if (map instanceof SortedMap) { @@ -487,8 +491,8 @@ private static ImmutableSortedMap copyOfInternal( return fromEntries(comparator, sameComparator, map.entrySet()); } - private static , V> ImmutableSortedMap fromEntries( - Entry... entries) { + private static , V> ImmutableSortedMap fromEntries( + @Immutable Entry... entries) { return fromEntries(Ordering.natural(), false, entries, entries.length); } @@ -496,7 +500,7 @@ private static , V> ImmutableSortedMap fro * Accepts a collection of possibly-null entries. If {@code sameComparator}, then it is assumed * that they do not need to be sorted or checked for dupes. */ - private static ImmutableSortedMap fromEntries( + private static ImmutableSortedMap fromEntries( Comparator comparator, boolean sameComparator, Iterable> entries) { @@ -508,7 +512,7 @@ private static ImmutableSortedMap fromEntries( return fromEntries(comparator, sameComparator, entryArray, entryArray.length); } - private static ImmutableSortedMap fromEntries( + private static ImmutableSortedMap fromEntries( final Comparator comparator, boolean sameComparator, @Nullable Entry[] entryArray, @@ -521,8 +525,8 @@ private static ImmutableSortedMap fromEntries( Entry onlyEntry = requireNonNull(entryArray[0]); return of(comparator, onlyEntry.getKey(), onlyEntry.getValue()); default: - Object[] keys = new Object[size]; - Object[] values = new Object[size]; + @Immutable Object[] keys = new Object[size]; + @Readonly Object[] values = new Object[size]; if (sameComparator) { // Need to check for nulls, but don't need to sort or validate. for (int i = 0; i < size; i++) { @@ -592,7 +596,7 @@ public static , V> Builder naturalOrder() { * * @throws NullPointerException if {@code comparator} is null */ - public static Builder orderedBy(Comparator comparator) { + public static Builder orderedBy(Comparator comparator) { return new Builder<>(comparator); } @@ -625,7 +629,7 @@ public static , V> Builder reverseOrder() { * * @since 2.0 */ - public static class Builder extends ImmutableMap.Builder { + public static @Mutable class Builder extends ImmutableMap.Builder { private final Comparator comparator; /** @@ -823,6 +827,7 @@ boolean isPartialView() { @Override ImmutableSet> createEntrySet() { + @Immutable class EntrySet extends ImmutableMapEntrySet { @Override public UnmodifiableIterator> iterator() { @@ -1155,7 +1160,7 @@ public ImmutableSortedMap descendingMap() { * are reconstructed using public factory methods. This ensures that the implementation types * remain as implementation details. */ - private static class SerializedForm extends ImmutableMap.SerializedForm { + private static class SerializedForm extends ImmutableMap.SerializedForm { private final Comparator comparator; SerializedForm(ImmutableSortedMap sortedMap) { @@ -1181,5 +1186,5 @@ Object writeReplace() { private static final long serialVersionUID = 0; @Pure -public boolean containsValue(@Nullable @UnknownSignedness Object arg0) { return super.containsValue(arg0); } +public boolean containsValue(@Nullable @UnknownSignedness @Readonly Object arg0) { return super.containsValue(arg0); } } diff --git a/guava/src/com/google/common/collect/ImmutableSortedMapFauxverideShim.java b/guava/src/com/google/common/collect/ImmutableSortedMapFauxverideShim.java index 7b2e4d7552ec..c641064ca050 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedMapFauxverideShim.java +++ b/guava/src/com/google/common/collect/ImmutableSortedMapFauxverideShim.java @@ -22,6 +22,9 @@ import java.util.function.Function; import java.util.stream.Collector; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * "Overrides" the {@link ImmutableMap} static methods that lack {@link ImmutableSortedMap} @@ -30,9 +33,11 @@ * * @author Chris Povirk */ +@AnnotatedFor("pico") @GwtIncompatible @ElementTypesAreNonnullByDefault -abstract class ImmutableSortedMapFauxverideShim extends ImmutableMap { +@Immutable +abstract class ImmutableSortedMapFauxverideShim extends ImmutableMap { /** * Not supported. Use {@link ImmutableSortedMap#toImmutableSortedMap}, which offers better * type-safety, instead. This method exists only to hide {@link ImmutableMap#toImmutableMap} from @@ -43,7 +48,7 @@ abstract class ImmutableSortedMapFauxverideShim extends ImmutableMap */ @DoNotCall("Use toImmutableSortedMap") @Deprecated - public static + public static Collector> toImmutableMap( Function keyFunction, Function valueFunction) { @@ -60,7 +65,7 @@ abstract class ImmutableSortedMapFauxverideShim extends ImmutableMap */ @DoNotCall("Use toImmutableSortedMap") @Deprecated - public static + public static Collector> toImmutableMap( Function keyFunction, Function valueFunction, @@ -78,7 +83,7 @@ abstract class ImmutableSortedMapFauxverideShim extends ImmutableMap */ @DoNotCall("Use naturalOrder") @Deprecated - public static ImmutableSortedMap.Builder builder() { + public static ImmutableSortedMap.Builder builder() { throw new UnsupportedOperationException(); } @@ -90,7 +95,7 @@ public static ImmutableSortedMap.Builder builder() { */ @DoNotCall("Use naturalOrder (which does not accept an expected size)") @Deprecated - public static ImmutableSortedMap.Builder builderWithExpectedSize(int expectedSize) { + public static ImmutableSortedMap.Builder builderWithExpectedSize(int expectedSize) { throw new UnsupportedOperationException(); } @@ -105,7 +110,7 @@ public static ImmutableSortedMap.Builder builderWithExpectedSize(in */ @DoNotCall("Pass a key of type Comparable") @Deprecated - public static ImmutableSortedMap of(K k1, V v1) { + public static ImmutableSortedMap of(K k1, V v1) { throw new UnsupportedOperationException(); } @@ -120,7 +125,7 @@ public static ImmutableSortedMap of(K k1, V v1) { */ @DoNotCall("Pass keys of type Comparable") @Deprecated - public static ImmutableSortedMap of(K k1, V v1, K k2, V v2) { + public static ImmutableSortedMap of(K k1, V v1, K k2, V v2) { throw new UnsupportedOperationException(); } @@ -135,7 +140,7 @@ public static ImmutableSortedMap of(K k1, V v1, K k2, V v2) { */ @DoNotCall("Pass keys of type Comparable") @Deprecated - public static ImmutableSortedMap of(K k1, V v1, K k2, V v2, K k3, V v3) { + public static ImmutableSortedMap of(K k1, V v1, K k2, V v2, K k3, V v3) { throw new UnsupportedOperationException(); } @@ -151,7 +156,7 @@ public static ImmutableSortedMap of(K k1, V v1, K k2, V v2, K k3, V */ @DoNotCall("Pass keys of type Comparable") @Deprecated - public static ImmutableSortedMap of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { + public static ImmutableSortedMap of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { throw new UnsupportedOperationException(); } @@ -167,7 +172,7 @@ public static ImmutableSortedMap of(K k1, V v1, K k2, V v2, K k3, V */ @DoNotCall("Pass keys of type Comparable") @Deprecated - public static ImmutableSortedMap of( + public static ImmutableSortedMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) { throw new UnsupportedOperationException(); } @@ -184,7 +189,7 @@ public static ImmutableSortedMap of( */ @DoNotCall("Pass keys of type Comparable") @Deprecated - public static ImmutableSortedMap of( + public static ImmutableSortedMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) { throw new UnsupportedOperationException(); } @@ -201,7 +206,7 @@ public static ImmutableSortedMap of( */ @DoNotCall("Pass keys of type Comparable") @Deprecated - public static ImmutableSortedMap of( + public static ImmutableSortedMap of( K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) { throw new UnsupportedOperationException(); } @@ -218,7 +223,7 @@ public static ImmutableSortedMap of( */ @DoNotCall("Pass keys of type Comparable") @Deprecated - public static ImmutableSortedMap of( + public static ImmutableSortedMap of( K k1, V v1, K k2, @@ -250,7 +255,7 @@ public static ImmutableSortedMap of( */ @DoNotCall("Pass keys of type Comparable") @Deprecated - public static ImmutableSortedMap of( + public static ImmutableSortedMap of( K k1, V v1, K k2, @@ -284,7 +289,7 @@ public static ImmutableSortedMap of( */ @DoNotCall("Pass keys of type Comparable") @Deprecated - public static ImmutableSortedMap of( + public static ImmutableSortedMap of( K k1, V v1, K k2, @@ -315,7 +320,7 @@ public static ImmutableSortedMap of( */ @DoNotCall("ImmutableSortedMap.ofEntries not currently available; use ImmutableSortedMap.copyOf") @Deprecated - public static ImmutableSortedMap ofEntries( + public static ImmutableSortedMap ofEntries( Entry... entries) { throw new UnsupportedOperationException(); } diff --git a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java index 0638df04e09d..19ed06c7c5b0 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java +++ b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java @@ -33,6 +33,10 @@ import java.util.stream.Collector; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A {@link SortedMultiset} whose contents will never change, with many other important properties @@ -50,8 +54,10 @@ * @author Louis Wasserman * @since 12.0 */ +@AnnotatedFor("pico") @GwtIncompatible // hasn't been tested yet @ElementTypesAreNonnullByDefault +@Immutable public abstract class ImmutableSortedMultiset extends ImmutableSortedMultisetFauxverideShim implements SortedMultiset { // TODO(lowasser): GWT compatibility @@ -81,7 +87,7 @@ public abstract class ImmutableSortedMultiset extends ImmutableSortedMultiset * * @since 22.0 */ - public static + public static Collector> toImmutableSortedMultiset( Comparator comparator, Function elementFunction, @@ -453,6 +459,7 @@ public static > Builder naturalOrder() { * * @since 12.0 */ + @Mutable public static class Builder extends ImmutableMultiset.Builder { /** * Creates a new builder. The returned builder is equivalent to the builder generated by {@link diff --git a/guava/src/com/google/common/collect/ImmutableSortedMultisetFauxverideShim.java b/guava/src/com/google/common/collect/ImmutableSortedMultisetFauxverideShim.java index 94a2f560da4b..ce19821835e3 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedMultisetFauxverideShim.java +++ b/guava/src/com/google/common/collect/ImmutableSortedMultisetFauxverideShim.java @@ -20,6 +20,9 @@ import java.util.function.ToIntFunction; import java.util.stream.Collector; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * "Overrides" the {@link ImmutableMultiset} static methods that lack {@link @@ -38,8 +41,10 @@ * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtIncompatible @ElementTypesAreNonnullByDefault +@Immutable abstract class ImmutableSortedMultisetFauxverideShim extends ImmutableMultiset { /** * Not supported. Use {@link ImmutableSortedMultiset#toImmutableSortedMultiset} instead. This @@ -67,7 +72,7 @@ abstract class ImmutableSortedMultisetFauxverideShim extends ImmutableMultise */ @DoNotCall("Use toImmutableSortedMultiset.") @Deprecated - public static + public static Collector> toImmutableMultiset( Function elementFunction, ToIntFunction countFunction) { diff --git a/guava/src/com/google/common/collect/ImmutableSortedSet.java b/guava/src/com/google/common/collect/ImmutableSortedSet.java index ab5f583e8238..1a1971d8a0b6 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedSet.java +++ b/guava/src/com/google/common/collect/ImmutableSortedSet.java @@ -41,6 +41,9 @@ import java.util.stream.Collector; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; @@ -63,10 +66,11 @@ * @since 2.0 (implements {@code NavigableSet} since 12.0) */ // TODO(benyu): benchmark and optimize all creation paths, which are a mess now -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization @ElementTypesAreNonnullByDefault +@Immutable public abstract class ImmutableSortedSet extends ImmutableSortedSetFauxverideShim implements NavigableSet, SortedIterable { static final int SPLITERATOR_CHARACTERISTICS = @@ -435,7 +439,7 @@ public static > Builder naturalOrder() { * * @since 2.0 */ - public static final class Builder extends ImmutableSet.Builder { + public static final @Mutable class Builder extends ImmutableSet.Builder { private final Comparator comparator; private E[] elements; private int n; @@ -581,11 +585,11 @@ public ImmutableSortedSet build() { } } - int unsafeCompare(@UnknownSignedness Object a, @CheckForNull @UnknownSignedness Object b) { + int unsafeCompare(@UnknownSignedness @Readonly Object a, @CheckForNull @UnknownSignedness @Readonly Object b) { return unsafeCompare(comparator, a, b); } - static int unsafeCompare(Comparator comparator, @UnknownSignedness Object a, @CheckForNull @UnknownSignedness Object b) { + static int unsafeCompare(Comparator comparator, @UnknownSignedness @Readonly Object a, @CheckForNull @UnknownSignedness @Readonly Object b) { // Pretend the comparator can compare anything. If it turns out it can't // compare a and b, we should get a CCE or NPE on the subsequent line. Only methods // that are spec'd to throw CCE and NPE should call this. @@ -843,7 +847,7 @@ public SerializedForm(Comparator comparator, Object[] elements) { } @SuppressWarnings("unchecked") - Object readResolve() { + @Immutable Object readResolve() { return new Builder(comparator).add((E[]) elements).build(); } diff --git a/guava/src/com/google/common/collect/ImmutableSortedSetFauxverideShim.java b/guava/src/com/google/common/collect/ImmutableSortedSetFauxverideShim.java index a5170e5bfd17..6432414fc4e9 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedSetFauxverideShim.java +++ b/guava/src/com/google/common/collect/ImmutableSortedSetFauxverideShim.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.errorprone.annotations.DoNotCall; import java.util.stream.Collector; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -38,9 +39,10 @@ * * @author Chris Povirk */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtIncompatible @ElementTypesAreNonnullByDefault +@Immutable abstract class ImmutableSortedSetFauxverideShim extends ImmutableSet.CachingAsList { /** * Not supported. Use {@link ImmutableSortedSet#toImmutableSortedSet} instead. This method exists diff --git a/guava/src/com/google/common/collect/ImmutableTable.java b/guava/src/com/google/common/collect/ImmutableTable.java index 85f20642cb90..7f195bbacf7f 100644 --- a/guava/src/com/google/common/collect/ImmutableTable.java +++ b/guava/src/com/google/common/collect/ImmutableTable.java @@ -34,7 +34,11 @@ import java.util.stream.Collector; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A {@link Table} whose contents will never change, with many other important properties detailed @@ -48,7 +52,9 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class ImmutableTable extends AbstractTable +@AnnotatedFor("pico") +@Immutable +public abstract class ImmutableTable extends AbstractTable implements Serializable { /** @@ -61,7 +67,7 @@ public abstract class ImmutableTable extends AbstractTable * * @since 21.0 */ - public static + public static Collector> toImmutableTable( Function rowFunction, Function columnFunction, @@ -80,7 +86,7 @@ public abstract class ImmutableTable extends AbstractTable * * @since 21.0 */ - public static + public static Collector> toImmutableTable( Function rowFunction, Function columnFunction, @@ -96,12 +102,12 @@ public abstract class ImmutableTable extends AbstractTable *

Performance note: the instance returned is a singleton. */ @SuppressWarnings("unchecked") - public static ImmutableTable of() { + public static ImmutableTable of() { return (ImmutableTable) SparseImmutableTable.EMPTY; } /** Returns an immutable table containing a single cell. */ - public static ImmutableTable of(R rowKey, C columnKey, V value) { + public static ImmutableTable of(R rowKey, C columnKey, V value) { return new SingletonImmutableTable<>(rowKey, columnKey, value); } @@ -118,7 +124,7 @@ public static ImmutableTable of(R rowKey, C columnKey, V valu * safe to do so. The exact circumstances under which a copy will or will not be performed are * undocumented and subject to change. */ - public static ImmutableTable copyOf( + public static ImmutableTable copyOf( Table table) { if (table instanceof ImmutableTable) { @SuppressWarnings("unchecked") @@ -129,7 +135,7 @@ public static ImmutableTable copyOf( } } - static ImmutableTable copyOf( + static ImmutableTable copyOf( Iterable> cells) { ImmutableTable.Builder builder = ImmutableTable.builder(); for (Cell cell : cells) { @@ -142,7 +148,7 @@ static ImmutableTable copyOf( * Returns a new builder. The generated builder is equivalent to the builder created by the {@link * Builder#Builder() ImmutableTable.Builder()} constructor. */ - public static Builder builder() { + public static Builder builder() { return new Builder<>(); } @@ -150,7 +156,7 @@ public static Builder builder() { * Verifies that {@code rowKey}, {@code columnKey} and {@code value} are non-null, and returns a * new entry with those values. */ - static Cell cellOf(R rowKey, C columnKey, V value) { + static Cell cellOf(R rowKey, C columnKey, V value) { return Tables.immutableCell( checkNotNull(rowKey, "rowKey"), checkNotNull(columnKey, "columnKey"), @@ -184,7 +190,7 @@ static Cell cellOf(R rowKey, C columnKey, V value) { * @since 11.0 */ @DoNotMock - public static final class Builder { + public static final @Mutable class Builder { private final List> cells = Lists.newArrayList(); @CheckForNull private Comparator rowComparator; @CheckForNull private Comparator columnComparator; @@ -377,12 +383,12 @@ public ImmutableSet rowKeySet() { public abstract ImmutableMap> rowMap(); @Override - public boolean contains(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public boolean contains(@CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { return get(rowKey, columnKey) != null; } @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@CheckForNull @UnknownSignedness @Readonly Object value) { return values().contains(value); } @@ -449,6 +455,7 @@ public final V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKe * Serialized type for all ImmutableTable instances. It captures the logical contents and * preserves iteration order of all views. */ + @Immutable static final class SerializedForm implements Serializable { private final Object[] rowKeys; private final Object[] columnKeys; @@ -480,14 +487,14 @@ static SerializedForm create( cellColumnIndices); } - Object readResolve() { + @Immutable Object readResolve() { if (cellValues.length == 0) { return of(); } if (cellValues.length == 1) { return of(rowKeys[0], columnKeys[0], cellValues[0]); } - ImmutableList.Builder> cellListBuilder = + ImmutableList.Builder> cellListBuilder = new ImmutableList.Builder<>(cellValues.length); for (int i = 0; i < cellValues.length; i++) { cellListBuilder.add( diff --git a/guava/src/com/google/common/collect/IndexedImmutableSet.java b/guava/src/com/google/common/collect/IndexedImmutableSet.java index 05bd8b127d59..161c1eb64e44 100644 --- a/guava/src/com/google/common/collect/IndexedImmutableSet.java +++ b/guava/src/com/google/common/collect/IndexedImmutableSet.java @@ -24,9 +24,14 @@ import java.util.function.Consumer; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; +@AnnotatedFor("pico") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@Immutable abstract class IndexedImmutableSet extends ImmutableSet.CachingAsList { abstract E get(int index); @@ -51,7 +56,7 @@ public void forEach(Consumer consumer) { @Override @GwtIncompatible - int copyIntoArray(@Nullable Object[] dst, int offset) { + int copyIntoArray(@Nullable @Readonly Object[] dst, int offset) { return asList().copyIntoArray(dst, offset); } diff --git a/guava/src/com/google/common/collect/Interners.java b/guava/src/com/google/common/collect/Interners.java index cb44bc1990a5..a0a532ba3637 100644 --- a/guava/src/com/google/common/collect/Interners.java +++ b/guava/src/com/google/common/collect/Interners.java @@ -23,6 +23,7 @@ import com.google.common.collect.MapMaker.Dummy; import com.google.common.collect.MapMakerInternalMap.InternalEntry; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -112,7 +113,7 @@ public static Interner newWeakInterner() { } @VisibleForTesting - static final class InternerImpl implements Interner { + static final class InternerImpl implements Interner { // MapMaker is our friend, we know about this type @VisibleForTesting final MapMakerInternalMap map; diff --git a/guava/src/com/google/common/collect/Iterables.java b/guava/src/com/google/common/collect/Iterables.java index 2ec4c614a5ce..d2fb9a35ba91 100644 --- a/guava/src/com/google/common/collect/Iterables.java +++ b/guava/src/com/google/common/collect/Iterables.java @@ -42,6 +42,8 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -74,7 +76,7 @@ public final class Iterables { private Iterables() {} /** Returns an unmodifiable view of {@code iterable}. */ - public static Iterable unmodifiableIterable( + public static Iterable unmodifiableIterable( final Iterable iterable) { checkNotNull(iterable); if (iterable instanceof UnmodifiableIterable || iterable instanceof ImmutableCollection) { @@ -96,7 +98,7 @@ public static Iterable unmodifiableIterable(ImmutableCollection iterab return checkNotNull(iterable); } - private static final class UnmodifiableIterable + private static final class UnmodifiableIterable extends FluentIterable { private final Iterable iterable; @@ -143,7 +145,7 @@ public static int size(Iterable iterable) { */ @Pure public static boolean contains( - Iterable iterable, @CheckForNull Object element) { + Iterable iterable, @CheckForNull Object element) { if (iterable instanceof Collection) { Collection collection = (Collection) iterable; return Collections2.safeContains(collection, element); @@ -162,7 +164,7 @@ public static boolean contains( * @return {@code true} if any element was removed from {@code iterable} */ @CanIgnoreReturnValue - public static boolean removeAll(Iterable removeFrom, Collection elementsToRemove) { + public static boolean removeAll(Iterable removeFrom, @Mutable Collection elementsToRemove) { return (removeFrom instanceof Collection) ? ((Collection) removeFrom).removeAll(checkNotNull(elementsToRemove)) : Iterators.removeAll(removeFrom.iterator(), elementsToRemove); @@ -202,7 +204,7 @@ public static boolean retainAll(Iterable removeFrom, Collection elementsTo * @since 2.0 */ @CanIgnoreReturnValue - public static boolean removeIf( + public static boolean removeIf( Iterable removeFrom, Predicate predicate) { if (removeFrom instanceof Collection) { return ((Collection) removeFrom).removeIf(predicate); @@ -212,7 +214,7 @@ public static boolean retainAll(Iterable removeFrom, Collection elementsTo /** Removes and returns the first matching element, or returns {@code null} if there is none. */ @CheckForNull - static T removeFirstMatching( + static T removeFirstMatching( Iterable removeFrom, Predicate predicate) { checkNotNull(predicate); Iterator iterator = removeFrom.iterator(); @@ -265,7 +267,7 @@ public static String toString(Iterable iterable) { * @throws IllegalArgumentException if the iterable contains multiple elements */ @ParametricNullness - public static T getOnlyElement(Iterable iterable) { + public static T getOnlyElement(Iterable iterable) { return Iterators.getOnlyElement(iterable.iterator()); } @@ -279,7 +281,7 @@ public static String toString(Iterable iterable) { * @throws IllegalArgumentException if the iterator contains multiple elements */ @ParametricNullness - public static T getOnlyElement( + public static T getOnlyElement( Iterable iterable, @ParametricNullness T defaultValue) { return Iterators.getOnlyElement(iterable.iterator(), defaultValue); } @@ -301,7 +303,7 @@ public static String toString(Iterable iterable) { return toArray(iterable, ObjectArrays.newArray(type, 0)); } - static T[] toArray(Iterable iterable, T[] array) { + static T[] toArray(Iterable iterable, T[] array) { Collection collection = castOrCopyToCollection(iterable); return collection.toArray(array); } @@ -321,7 +323,7 @@ public static String toString(Iterable iterable) { * returned. Otherwise, an {@link java.util.ArrayList} is created with the contents of the * iterable in the same iteration order. */ - private static Collection castOrCopyToCollection( + private static Collection castOrCopyToCollection( Iterable iterable) { return (iterable instanceof Collection) ? (Collection) iterable @@ -334,8 +336,8 @@ public static String toString(Iterable iterable) { * @return {@code true} if {@code collection} was modified as a result of this operation. */ @CanIgnoreReturnValue - public static boolean addAll( - Collection addTo, Iterable elementsToAdd) { + public static boolean addAll( + @Mutable Collection addTo, @Readonly Iterable elementsToAdd) { if (elementsToAdd instanceof Collection) { Collection c = (Collection) elementsToAdd; return addTo.addAll(c); @@ -381,7 +383,7 @@ public static int frequency(Iterable iterable, @CheckForNull Object element) *

Java 8 users: The {@code Stream} equivalent of this method is {@code * Stream.generate(() -> iterable).flatMap(Streams::stream)}. */ - public static Iterable cycle(final Iterable iterable) { + public static Iterable cycle(final Iterable iterable) { checkNotNull(iterable); return new FluentIterable() { @Override @@ -423,7 +425,7 @@ public String toString() { * and use {@code Stream.generate(() -> collection).flatMap(Collection::stream)}. */ @SafeVarargs - public static Iterable cycle(T... elements) { + public static Iterable cycle(T... elements) { return cycle(Lists.newArrayList(elements)); } @@ -438,7 +440,7 @@ public String toString() { *

Java 8 users: The {@code Stream} equivalent of this method is {@code Stream.concat(a, * b)}. */ - public static Iterable concat( + public static Iterable concat( Iterable a, Iterable b) { return FluentIterable.concat(a, b); } @@ -454,7 +456,7 @@ public String toString() { *

Java 8 users: The {@code Stream} equivalent of this method is {@code * Streams.concat(a, b, c)}. */ - public static Iterable concat( + public static Iterable concat( Iterable a, Iterable b, Iterable c) { return FluentIterable.concat(a, b, c); } @@ -471,7 +473,7 @@ public String toString() { *

Java 8 users: The {@code Stream} equivalent of this method is {@code * Streams.concat(a, b, c, d)}. */ - public static Iterable concat( + public static Iterable concat( Iterable a, Iterable b, Iterable c, @@ -493,7 +495,7 @@ public String toString() { * @throws NullPointerException if any of the provided iterables is null */ @SafeVarargs - public static Iterable concat(Iterable... inputs) { + public static Iterable concat(Iterable... inputs) { return FluentIterable.concat(inputs); } @@ -509,7 +511,7 @@ public String toString() { *

Java 8 users: The {@code Stream} equivalent of this method is {@code * streamOfStreams.flatMap(s -> s)}. */ - public static Iterable concat( + public static Iterable concat( Iterable> inputs) { return FluentIterable.concat(inputs); } @@ -536,7 +538,7 @@ public String toString() { * into partitions * @throws IllegalArgumentException if {@code size} is nonpositive */ - public static Iterable> partition( + public static Iterable> partition( final Iterable iterable, final int size) { checkNotNull(iterable); checkArgument(size > 0); @@ -563,7 +565,7 @@ public Iterator> iterator() { * into partitions (the final iterable may have trailing null elements) * @throws IllegalArgumentException if {@code size} is nonpositive */ - public static Iterable> paddedPartition( + public static Iterable> paddedPartition( final Iterable iterable, final int size) { checkNotNull(iterable); checkArgument(size > 0); @@ -581,13 +583,13 @@ public Iterator> iterator() { * *

{@code Stream} equivalent: {@link Stream#filter}. */ - public static Iterable filter( + public static Iterable filter( final Iterable unfiltered, final Predicate retainIfTrue) { checkNotNull(unfiltered); checkNotNull(retainIfTrue); return new FluentIterable() { @Override - public Iterator iterator() { + public @Readonly Iterator iterator() { return Iterators.filter(unfiltered.iterator(), retainIfTrue); } @@ -636,7 +638,7 @@ public static Iterable filter(final Iterable unfiltered, final Class{@code Stream} equivalent: {@link Stream#anyMatch}. */ - public static boolean any( + public static boolean any( Iterable iterable, Predicate predicate) { return Iterators.any(iterable.iterator(), predicate); } @@ -647,7 +649,7 @@ public static Iterable filter(final Iterable unfiltered, final Class{@code Stream} equivalent: {@link Stream#allMatch}. */ - public static boolean all( + public static boolean all( Iterable iterable, Predicate predicate) { return Iterators.all(iterable.iterator(), predicate); } @@ -662,7 +664,7 @@ public static Iterable filter(final Iterable unfiltered, final Class T find( + public static T find( Iterable iterable, Predicate predicate) { return Iterators.find(iterable.iterator(), predicate); } @@ -693,7 +695,7 @@ public static Iterable filter(final Iterable unfiltered, final Class T find( + public static T find( Iterable iterable, Predicate predicate, @CheckForNull T defaultValue) { @@ -725,7 +727,7 @@ public static Optional tryFind(Iterable iterable, Predicate * * @since 2.0 */ - public static int indexOf( + public static int indexOf( Iterable iterable, Predicate predicate) { return Iterators.indexOf(iterable.iterator(), predicate); } @@ -743,7 +745,7 @@ public static Optional tryFind(Iterable iterable, Predicate * *

{@code Stream} equivalent: {@link Stream#map} */ - public static Iterable transform( + public static Iterable transform( final Iterable fromIterable, final Function function) { checkNotNull(fromIterable); checkNotNull(function); @@ -778,7 +780,7 @@ public Spliterator spliterator() { * the size of {@code iterable} */ @ParametricNullness - public static T get(Iterable iterable, int position) { + public static T get(Iterable iterable, int position) { checkNotNull(iterable); return (iterable instanceof List) ? ((List) iterable).get(position) @@ -801,7 +803,7 @@ public Spliterator spliterator() { * @since 4.0 */ @ParametricNullness - public static T get( + public static T get( Iterable iterable, int position, @ParametricNullness T defaultValue) { checkNotNull(iterable); Iterators.checkNonnegative(position); @@ -833,7 +835,7 @@ public Spliterator spliterator() { * @since 7.0 */ @ParametricNullness - public static T getFirst( + public static T getFirst( Iterable iterable, @ParametricNullness T defaultValue) { return Iterators.getNext(iterable.iterator(), defaultValue); } @@ -848,7 +850,7 @@ public Spliterator spliterator() { * @throws NoSuchElementException if the iterable is empty */ @ParametricNullness - public static T getLast(Iterable iterable) { + public static T getLast(Iterable iterable) { // TODO(kevinb): Support a concurrently modified collection? if (iterable instanceof List) { List list = (List) iterable; @@ -873,7 +875,7 @@ public Spliterator spliterator() { * @since 3.0 */ @ParametricNullness - public static T getLast( + public static T getLast( Iterable iterable, @ParametricNullness T defaultValue) { if (iterable instanceof Collection) { Collection c = (Collection) iterable; @@ -888,7 +890,7 @@ public Spliterator spliterator() { } @ParametricNullness - private static T getLastInNonemptyList(List list) { + private static T getLastInNonemptyList(List list) { return list.get(list.size() - 1); } @@ -911,7 +913,7 @@ public Spliterator spliterator() { * * @since 3.0 */ - public static Iterable skip( + public static Iterable skip( final Iterable iterable, final int numberToSkip) { checkNotNull(iterable); checkArgument(numberToSkip >= 0, "number to skip cannot be negative"); @@ -983,7 +985,7 @@ public Spliterator spliterator() { * @throws IllegalArgumentException if {@code limitSize} is negative * @since 3.0 */ - public static Iterable limit( + public static Iterable limit( final Iterable iterable, final int limitSize) { checkNotNull(iterable); checkArgument(limitSize >= 0, "limit is negative"); @@ -1016,7 +1018,7 @@ public Spliterator spliterator() { * @see Iterators#consumingIterator(Iterator) * @since 2.0 */ - public static Iterable consumingIterable( + public static Iterable consumingIterable( final Iterable iterable) { checkNotNull(iterable); @@ -1069,7 +1071,7 @@ public static boolean isEmpty(Iterable iterable) { * @since 11.0 */ @Beta - public static Iterable mergeSorted( + public static Iterable mergeSorted( final Iterable> iterables, final Comparator comparator) { checkNotNull(iterables, "iterables"); @@ -1087,7 +1089,7 @@ public Iterator iterator() { // TODO(user): Is this the best place for this? Move to fluent functions? // Useful as a public method? - static + static Function, Iterator> toIterator() { return new Function, Iterator>() { @Override diff --git a/guava/src/com/google/common/collect/Iterators.java b/guava/src/com/google/common/collect/Iterators.java index 039917402e49..9322002ef94d 100644 --- a/guava/src/com/google/common/collect/Iterators.java +++ b/guava/src/com/google/common/collect/Iterators.java @@ -49,9 +49,15 @@ import java.util.Queue; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * This class contains static utility methods that operate on or return objects of type {@link @@ -70,7 +76,7 @@ * @author Jared Levy * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault public final class Iterators { @@ -81,7 +87,7 @@ private Iterators() {} * *

The {@link Iterable} equivalent of this method is {@link ImmutableSet#of()}. */ - static UnmodifiableIterator emptyIterator() { + static @Readonly UnmodifiableIterator emptyIterator() { return emptyListIterator(); } @@ -92,15 +98,15 @@ private Iterators() {} */ // Casting to any type is safe since there are no actual elements. @SuppressWarnings("unchecked") - static UnmodifiableListIterator emptyListIterator() { - return (UnmodifiableListIterator) ArrayItr.EMPTY; + static @Readonly UnmodifiableListIterator emptyListIterator() { + return (@Readonly UnmodifiableListIterator) ArrayItr.EMPTY; } /** * This is an enum singleton rather than an anonymous class so ProGuard can figure out it's only * referenced by emptyModifiableIterator(). */ - private enum EmptyModifiableIterator implements Iterator { + private enum EmptyModifiableIterator implements Iterator<@Readonly Object> { INSTANCE; @Override @@ -125,13 +131,13 @@ public void remove() { */ // Casting to any type is safe since there are no actual elements. @SuppressWarnings("unchecked") - static Iterator emptyModifiableIterator() { - return (Iterator) EmptyModifiableIterator.INSTANCE; + static @Readonly Iterator emptyModifiableIterator() { + return (@Readonly Iterator) EmptyModifiableIterator.INSTANCE; } /** Returns an unmodifiable view of {@code iterator}. */ - public static UnmodifiableIterator unmodifiableIterator( - Iterator iterator) { + public static @Readonly UnmodifiableIterator unmodifiableIterator( + @Readonly Iterator iterator) { checkNotNull(iterator); if (iterator instanceof UnmodifiableIterator) { @SuppressWarnings("unchecked") // Since it's unmodifiable, the covariant cast is safe @@ -159,8 +165,8 @@ public T next() { * @since 10.0 */ @Deprecated - public static UnmodifiableIterator unmodifiableIterator( - UnmodifiableIterator iterator) { + public static @Readonly UnmodifiableIterator unmodifiableIterator( + @Readonly UnmodifiableIterator iterator) { return checkNotNull(iterator); } @@ -179,7 +185,7 @@ public static int size(Iterator iterator) { /** Returns {@code true} if {@code iterator} contains {@code element}. */ @Pure - public static boolean contains(Iterator iterator, @CheckForNull @UnknownSignedness Object element) { + public static boolean contains(Iterator iterator, @CheckForNull @UnknownSignedness @Readonly Object element) { if (element == null) { while (iterator.hasNext()) { if (iterator.next() == null) { @@ -205,7 +211,7 @@ public static boolean contains(Iterator iterator, @CheckForNull @UnknownSigne * @return {@code true} if any element was removed from {@code iterator} */ @CanIgnoreReturnValue - public static boolean removeAll(Iterator removeFrom, Collection elementsToRemove) { + public static boolean removeAll(Iterator removeFrom, @Readonly Collection elementsToRemove) { checkNotNull(elementsToRemove); boolean result = false; while (removeFrom.hasNext()) { @@ -227,7 +233,7 @@ public static boolean removeAll(Iterator removeFrom, Collection elementsTo * @since 2.0 */ @CanIgnoreReturnValue - public static boolean removeIf( + public static boolean removeIf( Iterator removeFrom, Predicate predicate) { checkNotNull(predicate); boolean modified = false; @@ -250,7 +256,7 @@ public static boolean removeAll(Iterator removeFrom, Collection elementsTo * @return {@code true} if any element was removed from {@code iterator} */ @CanIgnoreReturnValue - public static boolean retainAll(Iterator removeFrom, Collection elementsToRetain) { + public static boolean retainAll(Iterator removeFrom, @Readonly Collection elementsToRetain) { checkNotNull(elementsToRetain); boolean result = false; while (removeFrom.hasNext()) { @@ -311,7 +317,7 @@ public static String toString(Iterator iterator) { * iterator is unspecified. */ @ParametricNullness - public static T getOnlyElement(Iterator iterator) { + public static T getOnlyElement(Iterator iterator) { T first = iterator.next(); if (!iterator.hasNext()) { return first; @@ -337,8 +343,8 @@ public static String toString(Iterator iterator) { * iterator is unspecified. */ @ParametricNullness - public static T getOnlyElement( - Iterator iterator, @ParametricNullness T defaultValue) { + public static T getOnlyElement( + Iterator iterator, @ParametricNullness T defaultValue) { return iterator.hasNext() ? getOnlyElement(iterator) : defaultValue; } @@ -364,7 +370,7 @@ public static String toString(Iterator iterator) { * @return {@code true} if {@code collection} was modified as a result of this operation */ @CanIgnoreReturnValue - public static boolean addAll( + public static boolean addAll( Collection addTo, Iterator iterator) { checkNotNull(addTo); checkNotNull(iterator); @@ -381,7 +387,7 @@ public static String toString(Iterator iterator) { * * @see Collections#frequency */ - public static int frequency(Iterator iterator, @CheckForNull Object element) { + public static int frequency(Iterator iterator, @CheckForNull @Readonly Object element) { int count = 0; while (contains(iterator, element)) { // Since it lives in the same class, we know contains gets to the element and then stops, @@ -403,7 +409,7 @@ public static int frequency(Iterator iterator, @CheckForNull Object element) * should use an explicit {@code break} or be certain that you will eventually remove all the * elements. */ - public static Iterator cycle(Iterable iterable) { + public static Iterator cycle(Iterable iterable) { checkNotNull(iterable); return new Iterator() { Iterator iterator = emptyModifiableIterator(); @@ -454,7 +460,7 @@ public void remove() { * elements. */ @SafeVarargs - public static Iterator cycle(T... elements) { + public static Iterator cycle(T... elements) { return cycle(Lists.newArrayList(elements)); } @@ -468,7 +474,7 @@ public void remove() { * *

This is mainly just to avoid the intermediate ArrayDeque in ConsumingQueueIterator. */ - private static > Iterator consumingForArray(@Nullable I... elements) { + private static > @Readonly Iterator consumingForArray(@Nullable I... elements) { return new UnmodifiableIterator() { int index = 0; @@ -502,7 +508,7 @@ public I next() { *

The returned iterator supports {@code remove()} when the corresponding input iterator * supports it. */ - public static Iterator concat( + public static Iterator concat( Iterator a, Iterator b) { checkNotNull(a); checkNotNull(b); @@ -517,7 +523,7 @@ public I next() { *

The returned iterator supports {@code remove()} when the corresponding input iterator * supports it. */ - public static Iterator concat( + public static Iterator concat( Iterator a, Iterator b, Iterator c) { checkNotNull(a); checkNotNull(b); @@ -534,7 +540,7 @@ public I next() { *

The returned iterator supports {@code remove()} when the corresponding input iterator * supports it. */ - public static Iterator concat( + public static Iterator concat( Iterator a, Iterator b, Iterator c, @@ -556,7 +562,7 @@ public I next() { * * @throws NullPointerException if any of the provided iterators is null */ - public static Iterator concat(Iterator... inputs) { + public static Iterator concat(Iterator... inputs) { return concatNoDefensiveCopy(Arrays.copyOf(inputs, inputs.length)); } @@ -569,13 +575,13 @@ public I next() { * supports it. The methods of the returned iterator may throw {@code NullPointerException} if any * of the input iterators is null. */ - public static Iterator concat( - Iterator> inputs) { + public static Iterator concat( + Iterator> inputs) { return new ConcatenatedIterator<>(inputs); } /** Concats a varargs array of iterators without making a defensive copy of the array. */ - static Iterator concatNoDefensiveCopy( + static Iterator concatNoDefensiveCopy( Iterator... inputs) { for (Iterator input : checkNotNull(inputs)) { checkNotNull(input); @@ -601,7 +607,7 @@ public I next() { * partitions * @throws IllegalArgumentException if {@code size} is nonpositive */ - public static UnmodifiableIterator> partition( + public static UnmodifiableIterator> partition( Iterator iterator, int size) { return partitionImpl(iterator, size, false); } @@ -620,12 +626,12 @@ public I next() { * partitions (the final iterable may have trailing null elements) * @throws IllegalArgumentException if {@code size} is nonpositive */ - public static + public static UnmodifiableIterator> paddedPartition(Iterator iterator, int size) { return partitionImpl(iterator, size, true); } - private static UnmodifiableIterator> partitionImpl( + private static UnmodifiableIterator> partitionImpl( Iterator iterator, int size, boolean pad) { checkNotNull(iterator); checkArgument(size > 0); @@ -666,7 +672,7 @@ public boolean hasNext() { * Returns a view of {@code unfiltered} containing all elements that satisfy the input predicate * {@code retainIfTrue}. */ - public static UnmodifiableIterator filter( + public static @Readonly UnmodifiableIterator filter( Iterator unfiltered, Predicate retainIfTrue) { checkNotNull(unfiltered); checkNotNull(retainIfTrue); @@ -691,15 +697,15 @@ protected T computeNext() { */ @SuppressWarnings("unchecked") // can cast to because non-Ts are removed @GwtIncompatible // Class.isInstance - public static UnmodifiableIterator filter(Iterator unfiltered, Class desiredType) { - return (UnmodifiableIterator) filter(unfiltered, instanceOf(desiredType)); + public static @Readonly UnmodifiableIterator filter(Iterator unfiltered, Class desiredType) { + return (@Readonly UnmodifiableIterator) filter(unfiltered, instanceOf(desiredType)); } /** * Returns {@code true} if one or more elements returned by {@code iterator} satisfy the given * predicate. */ - public static boolean any( + public static boolean any( Iterator iterator, Predicate predicate) { return indexOf(iterator, predicate) != -1; } @@ -708,7 +714,7 @@ public static UnmodifiableIterator filter(Iterator unfiltered, Class boolean all( + public static boolean all( Iterator iterator, Predicate predicate) { checkNotNull(predicate); while (iterator.hasNext()) { @@ -730,7 +736,7 @@ public static UnmodifiableIterator filter(Iterator unfiltered, Class T find( + public static T find( Iterator iterator, Predicate predicate) { checkNotNull(iterator); checkNotNull(predicate); @@ -753,7 +759,7 @@ public static UnmodifiableIterator filter(Iterator unfiltered, Class T find( + public static T find( Iterator iterator, Predicate predicate, @CheckForNull T defaultValue) { @@ -805,7 +811,7 @@ public static Optional tryFind(Iterator iterator, Predicate * * @since 2.0 */ - public static int indexOf( + public static int indexOf( Iterator iterator, Predicate predicate) { checkNotNull(predicate, "predicate"); for (int i = 0; iterator.hasNext(); i++) { @@ -825,7 +831,7 @@ public static Optional tryFind(Iterator iterator, Predicate * successful {@code remove()} call, {@code fromIterator} no longer contains the corresponding * element. */ - public static Iterator transform( + public static Iterator transform( Iterator fromIterator, Function function) { checkNotNull(function); return new TransformedIterator(fromIterator) { @@ -847,7 +853,7 @@ T transform(@ParametricNullness F from) { * the number of elements remaining in {@code iterator} */ @ParametricNullness - public static T get(Iterator iterator, int position) { + public static T get(Iterator iterator, int position) { checkNonnegative(position); int skipped = advance(iterator, position); if (!iterator.hasNext()) { @@ -874,7 +880,7 @@ T transform(@ParametricNullness F from) { * @since 4.0 */ @ParametricNullness - public static T get( + public static T get( Iterator iterator, int position, @ParametricNullness T defaultValue) { checkNonnegative(position); advance(iterator, position); @@ -896,7 +902,7 @@ static void checkNonnegative(int position) { * @since 7.0 */ @ParametricNullness - public static T getNext( + public static T getNext( Iterator iterator, @ParametricNullness T defaultValue) { return iterator.hasNext() ? iterator.next() : defaultValue; } @@ -908,7 +914,7 @@ static void checkNonnegative(int position) { * @throws NoSuchElementException if the iterator is empty */ @ParametricNullness - public static T getLast(Iterator iterator) { + public static T getLast(Iterator iterator) { while (true) { T current = iterator.next(); if (!iterator.hasNext()) { @@ -926,7 +932,7 @@ static void checkNonnegative(int position) { * @since 3.0 */ @ParametricNullness - public static T getLast( + public static T getLast( Iterator iterator, @ParametricNullness T defaultValue) { return iterator.hasNext() ? getLast(iterator) : defaultValue; } @@ -960,8 +966,8 @@ public static int advance(Iterator iterator, int numberToAdvance) { * @throws IllegalArgumentException if {@code limitSize} is negative * @since 3.0 */ - public static Iterator limit( - Iterator iterator, int limitSize) { + public static @PolyMutable Iterator limit( + @PolyMutable Iterator iterator, int limitSize) { checkNotNull(iterator); checkArgument(limitSize >= 0, "limit is negative"); return new Iterator() { @@ -1000,7 +1006,7 @@ public void remove() { * @return an iterator that removes and returns elements from the supplied iterator * @since 2.0 */ - public static Iterator consumingIterator(Iterator iterator) { + public static Iterator consumingIterator(Iterator iterator) { checkNotNull(iterator); return new UnmodifiableIterator() { @Override @@ -1028,7 +1034,7 @@ public String toString() { * such value. */ @CheckForNull - static T pollNext(Iterator iterator) { + static T pollNext(Iterator iterator) { if (iterator.hasNext()) { T result = iterator.next(); iterator.remove(); @@ -1060,7 +1066,7 @@ static void clear(Iterator iterator) { * {@link ImmutableList#copyOf(Object[])}}, or {@link ImmutableList#of}. */ @SafeVarargs - public static UnmodifiableIterator forArray(T... array) { + public static UnmodifiableIterator forArray(T... array) { return forArray(array, 0, array.length, 0); } @@ -1071,7 +1077,7 @@ static void clear(Iterator iterator) { *

The {@code Iterable} equivalent of this method is {@code * Arrays.asList(array).subList(offset, offset + length).listIterator(index)}. */ - static UnmodifiableListIterator forArray( + static UnmodifiableListIterator forArray( T[] array, int offset, int length, int index) { checkArgument(length >= 0); int end = offset + length; @@ -1085,14 +1091,15 @@ static void clear(Iterator iterator) { return new ArrayItr<>(array, offset, length, index); } - private static final class ArrayItr + @ReceiverDependentMutable + private static final class ArrayItr extends AbstractIndexedListIterator { - static final UnmodifiableListIterator EMPTY = new ArrayItr<>(new Object[0], 0, 0, 0); + static final UnmodifiableListIterator EMPTY = new @Immutable ArrayItr<>(new Object[0], 0, 0, 0); private final T[] array; private final int offset; - ArrayItr(T[] array, int offset, int length, int index) { + ArrayItr(T @ReceiverDependentMutable [] array, int offset, int length, int index) { super(length, index); this.array = array; this.offset = offset; @@ -1100,7 +1107,7 @@ private static final class ArrayItr @Override @ParametricNullness - protected T get(int index) { + protected T get(@Readonly ArrayItr this, int index) { return array[offset + index]; } } @@ -1110,7 +1117,7 @@ protected T get(int index) { * *

The {@link Iterable} equivalent of this method is {@link Collections#singleton}. */ - public static UnmodifiableIterator singletonIterator( + public static UnmodifiableIterator singletonIterator( @ParametricNullness T value) { return new UnmodifiableIterator() { boolean done; @@ -1142,7 +1149,7 @@ public T next() { *

Java 9 users: use {@code enumeration.asIterator()} instead, unless it is important to * return an {@code UnmodifiableIterator} instead of a plain {@code Iterator}. */ - public static UnmodifiableIterator forEnumeration( + public static UnmodifiableIterator forEnumeration( Enumeration enumeration) { checkNotNull(enumeration); return new UnmodifiableIterator() { @@ -1165,7 +1172,7 @@ public T next() { *

The {@code Iterable} equivalent of this method is either {@link Collections#enumeration} (if * you have a {@link Collection}), or {@code Iterators.asEnumeration(collection.iterator())}. */ - public static Enumeration asEnumeration(Iterator iterator) { + public static Enumeration asEnumeration(Iterator iterator) { checkNotNull(iterator); return new Enumeration() { @Override @@ -1182,24 +1189,25 @@ public T nextElement() { } /** Implementation of PeekingIterator that avoids peeking unless necessary. */ - private static class PeekingImpl implements PeekingIterator { + @ReceiverDependentMutable + private static class PeekingImpl implements PeekingIterator { private final Iterator iterator; private boolean hasPeeked; @CheckForNull private E peekedElement; - public PeekingImpl(Iterator iterator) { + public PeekingImpl(@ReceiverDependentMutable Iterator iterator) { this.iterator = checkNotNull(iterator); } @Override - public boolean hasNext() { + public boolean hasNext(@Readonly PeekingImpl this) { return hasPeeked || iterator.hasNext(); } @Override @ParametricNullness - public E next() { + public E next(@Mutable PeekingImpl this) { if (!hasPeeked) { return iterator.next(); } @@ -1211,14 +1219,14 @@ public E next() { } @Override - public void remove() { + public void remove(@Mutable PeekingImpl this) { checkState(!hasPeeked, "Can't remove after you've peeked at next"); iterator.remove(); } @Override @ParametricNullness - public E peek() { + public E peek(@Readonly PeekingImpl this) { if (!hasPeeked) { peekedElement = iterator.next(); hasPeeked = true; @@ -1264,7 +1272,7 @@ public E peek() { * @return a peeking iterator backed by that iterator. Apart from the additional {@link * PeekingIterator#peek()} method, this iterator behaves exactly the same as {@code iterator}. */ - public static PeekingIterator peekingIterator( + public static PeekingIterator peekingIterator( Iterator iterator) { if (iterator instanceof PeekingImpl) { // Safe to cast to because PeekingImpl only uses T @@ -1283,8 +1291,8 @@ public E peek() { * @since 10.0 */ @Deprecated - public static PeekingIterator peekingIterator( - PeekingIterator iterator) { + public static @PolyMutable PeekingIterator peekingIterator( + @PolyMutable PeekingIterator iterator) { return checkNotNull(iterator); } @@ -1301,7 +1309,7 @@ public E peek() { * @since 11.0 */ @Beta - public static UnmodifiableIterator mergeSorted( + public static UnmodifiableIterator mergeSorted( Iterable> iterators, Comparator comparator) { checkNotNull(iterators, "iterators"); checkNotNull(comparator, "comparator"); @@ -1318,8 +1326,10 @@ public E peek() { * iterators. (Retrieving all elements takes approximately O(N*log(M)) time, where N is the total * number of elements.) */ - private static class MergingIterator extends UnmodifiableIterator { - final Queue> queue; + @CFComment("AOSEN: Is this a design issue?") + @ReceiverDependentMutable + private static class MergingIterator extends UnmodifiableIterator { + final @Mutable Queue> queue; public MergingIterator( Iterable> iterators, Comparator itemComparator) { @@ -1339,13 +1349,13 @@ public MergingIterator( } @Override - public boolean hasNext() { + public boolean hasNext(@Readonly MergingIterator this) { return !queue.isEmpty(); } @Override @ParametricNullness - public T next() { + public T next(@Mutable MergingIterator this) { PeekingIterator nextIter = queue.remove(); T next = nextIter.next(); if (nextIter.hasNext()) { @@ -1355,12 +1365,13 @@ public T next() { } } - private static class ConcatenatedIterator implements Iterator { + @ReceiverDependentMutable + private static class ConcatenatedIterator implements Iterator { /* The last iterator to return an element. Calls to remove() go to this iterator. */ @CheckForNull private Iterator toRemove; /* The iterator currently returning elements. */ - private Iterator iterator; + private @Readonly Iterator iterator; /* * We track the "meta iterators," the iterators-of-iterators, below. Usually, topMetaIterator @@ -1374,14 +1385,14 @@ private static class ConcatenatedIterator implements // Only becomes nonnull if we encounter nested concatenations. @CheckForNull private Deque>> metaIterators; - ConcatenatedIterator(Iterator> metaIterator) { + ConcatenatedIterator(@ReceiverDependentMutable Iterator> metaIterator) { iterator = emptyIterator(); topMetaIterator = checkNotNull(metaIterator); } // Returns a nonempty meta-iterator or, if all meta-iterators are empty, null. @CheckForNull - private Iterator> getTopMetaIterator() { + private @PolyMutable Iterator> getTopMetaIterator(@PolyMutable ConcatenatedIterator this) { while (topMetaIterator == null || !topMetaIterator.hasNext()) { if (metaIterators != null && !metaIterators.isEmpty()) { topMetaIterator = metaIterators.removeFirst(); @@ -1393,7 +1404,7 @@ private Iterator> getTopMetaIterator() { } @Override - public boolean hasNext() { + public boolean hasNext(@Readonly ConcatenatedIterator this) { while (!checkNotNull(iterator).hasNext()) { // this weird checkNotNull positioning appears required by our tests, which expect // both hasNext and next to throw NPE if an input iterator is null. @@ -1432,7 +1443,7 @@ public boolean hasNext() { @Override @ParametricNullness - public T next() { + public T next(@Mutable ConcatenatedIterator this) { if (hasNext()) { toRemove = iterator; return iterator.next(); @@ -1442,7 +1453,7 @@ public T next() { } @Override - public void remove() { + public void remove(@Mutable ConcatenatedIterator this) { if (toRemove == null) { throw new IllegalStateException("no calls to next() since the last call to remove()"); } @@ -1452,7 +1463,7 @@ public void remove() { } /** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */ - static ListIterator cast(Iterator iterator) { - return (ListIterator) iterator; + static @PolyMutable ListIterator cast(@PolyMutable Iterator iterator) { + return (@PolyMutable ListIterator) iterator; } } diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java b/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java index e2c2720910f6..384ec00971e6 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java @@ -27,16 +27,21 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Implementation of ImmutableBiMap backed by a pair of JDK HashMaps, which have smartness * protecting against hash flooding. */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -final class JdkBackedImmutableBiMap extends ImmutableBiMap { +@Immutable +final class JdkBackedImmutableBiMap extends ImmutableBiMap { @VisibleForTesting - static ImmutableBiMap create(int n, @Nullable Entry[] entryArray) { + static ImmutableBiMap create(int n, @Nullable Entry[] entryArray) { Map forwardDelegate = Maps.newHashMapWithExpectedSize(n); Map backwardDelegate = Maps.newHashMapWithExpectedSize(n); for (int i = 0; i < n; i++) { @@ -88,6 +93,7 @@ public ImmutableBiMap inverse() { } @WeakOuter + @Immutable private final class InverseEntries extends ImmutableList> { @Override public Entry get(int index) { @@ -108,12 +114,12 @@ boolean isPartialView() { @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { return forwardDelegate.get(key); } @Override - ImmutableSet> createEntrySet() { + ImmutableSet<@Immutable Entry> createEntrySet() { return new ImmutableMapEntrySet.RegularEntrySet<>(this, entries); } diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableMap.java b/guava/src/com/google/common/collect/JdkBackedImmutableMap.java index ac8cd7d64c6b..262f11a98c52 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableMap.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableMap.java @@ -27,22 +27,28 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Implementation of ImmutableMap backed by a JDK HashMap, which has smartness protecting against * hash flooding. */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -final class JdkBackedImmutableMap extends ImmutableMap { +@Immutable +final class JdkBackedImmutableMap extends ImmutableMap { /** * Creates an {@code ImmutableMap} backed by a JDK HashMap. Used when probable hash flooding is * detected. This implementation may replace the entries in entryArray with its own entry objects * (though they will have the same key/value contents), and will take ownership of entryArray. */ - static ImmutableMap create( - int n, @Nullable Entry[] entryArray, boolean throwIfDuplicateKeys) { + static ImmutableMap create( + int n, @Nullable @Immutable Entry[] entryArray, boolean throwIfDuplicateKeys) { Map delegateMap = Maps.newHashMapWithExpectedSize(n); // If duplicates are allowed, this map will track the last value for each duplicated key. // A second pass will retain only the first entry for that key, but with this last value. The @@ -69,7 +75,7 @@ static ImmutableMap create( } if (duplicates != null) { @SuppressWarnings({"rawtypes", "unchecked"}) - Entry[] newEntryArray = new Entry[n - dupCount]; + @Immutable Entry[] newEntryArray = new @Immutable Entry[n - dupCount]; for (int inI = 0, outI = 0; inI < n; inI++) { Entry entry = requireNonNull(entryArray[inI]); K key = entry.getKey(); @@ -91,7 +97,7 @@ static ImmutableMap create( private final transient Map delegateMap; private final transient ImmutableList> entries; - JdkBackedImmutableMap(Map delegateMap, ImmutableList> entries) { + JdkBackedImmutableMap(@Immutable Map delegateMap, ImmutableList> entries) { this.delegateMap = delegateMap; this.entries = entries; } @@ -103,7 +109,7 @@ static ImmutableMap create( @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { return delegateMap.get(key); } diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java b/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java index 82472963f5a8..2c8c5be9e4e3 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java @@ -22,7 +22,10 @@ import java.util.Map; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * An implementation of ImmutableMultiset backed by a JDK Map and a list of entries. Used to protect @@ -30,14 +33,17 @@ * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -final class JdkBackedImmutableMultiset extends ImmutableMultiset { - private final Map delegateMap; +@CFComment("This E is used as Map key") +@Immutable +final class JdkBackedImmutableMultiset extends ImmutableMultiset { + private final @Immutable Map delegateMap; private final ImmutableList> entries; private final long size; - static ImmutableMultiset create(Collection> entries) { + static ImmutableMultiset create(Collection> entries) { @SuppressWarnings("unchecked") Entry[] entriesArray = entries.toArray(new Entry[0]); Map delegateMap = Maps.newHashMapWithExpectedSize(entriesArray.length); diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableSet.java b/guava/src/com/google/common/collect/JdkBackedImmutableSet.java index 80a99ed7cc29..e5dc9231a0a2 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableSet.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableSet.java @@ -18,7 +18,10 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * ImmutableSet implementation backed by a JDK HashSet, used to defend against apparent hash @@ -27,13 +30,15 @@ * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault +@Immutable final class JdkBackedImmutableSet extends IndexedImmutableSet { - private final Set delegate; + private final @Immutable Set delegate; private final ImmutableList delegateList; - JdkBackedImmutableSet(Set delegate, ImmutableList delegateList) { + JdkBackedImmutableSet(@Immutable Set delegate, ImmutableList delegateList) { this.delegate = delegate; this.delegateList = delegateList; } @@ -44,7 +49,7 @@ E get(int index) { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { return delegate.contains(object); } diff --git a/guava/src/com/google/common/collect/LexicographicalOrdering.java b/guava/src/com/google/common/collect/LexicographicalOrdering.java index f0c78d7e272f..1bd79fd8b90e 100644 --- a/guava/src/com/google/common/collect/LexicographicalOrdering.java +++ b/guava/src/com/google/common/collect/LexicographicalOrdering.java @@ -22,12 +22,13 @@ import java.util.Iterator; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** An ordering which sorts iterables by comparing corresponding elements pairwise. */ @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -final class LexicographicalOrdering extends Ordering> +final class LexicographicalOrdering extends Ordering> implements Serializable { final Comparator elementOrder; diff --git a/guava/src/com/google/common/collect/LinkedHashMultimap.java b/guava/src/com/google/common/collect/LinkedHashMultimap.java index 66eafbeaea0a..9a8e66ab6136 100644 --- a/guava/src/com/google/common/collect/LinkedHashMultimap.java +++ b/guava/src/com/google/common/collect/LinkedHashMultimap.java @@ -45,9 +45,16 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * Implementation of {@code Multimap} that does not allow duplicate key-value entries and that @@ -87,14 +94,15 @@ * @author Louis Wasserman * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public final class LinkedHashMultimap +@ReceiverDependentMutable +public final class LinkedHashMultimap extends LinkedHashMultimapGwtSerializationDependencies { /** Creates a new, empty {@code LinkedHashMultimap} with the default initial capacities. */ - public static + public static LinkedHashMultimap create() { return new LinkedHashMultimap<>(DEFAULT_KEY_CAPACITY, DEFAULT_VALUE_SET_CAPACITY); } @@ -108,7 +116,7 @@ LinkedHashMultimap create() { * @throws IllegalArgumentException if {@code expectedKeys} or {@code expectedValuesPerKey} is * negative */ - public static + public static LinkedHashMultimap create(int expectedKeys, int expectedValuesPerKey) { return new LinkedHashMultimap<>( Maps.capacity(expectedKeys), Maps.capacity(expectedValuesPerKey)); @@ -122,41 +130,42 @@ LinkedHashMultimap create(int expectedKeys, int expectedValuesPerKey) { * * @param multimap the multimap whose contents are copied to this multimap */ - public static + public static LinkedHashMultimap create(Multimap multimap) { LinkedHashMultimap result = create(multimap.keySet().size(), DEFAULT_VALUE_SET_CAPACITY); result.putAll(multimap); return result; } - private interface ValueSetLink { - ValueSetLink getPredecessorInValueSet(); + @ReceiverDependentMutable + private interface ValueSetLink { + ValueSetLink getPredecessorInValueSet(@Readonly ValueSetLink this); - ValueSetLink getSuccessorInValueSet(); + ValueSetLink getSuccessorInValueSet(@Readonly ValueSetLink this); - void setPredecessorInValueSet(ValueSetLink entry); + void setPredecessorInValueSet(@Mutable ValueSetLink this, @Readonly ValueSetLink entry); - void setSuccessorInValueSet(ValueSetLink entry); + void setSuccessorInValueSet(@Mutable ValueSetLink this, @Readonly ValueSetLink entry); } - private static void succeedsInValueSet( + private static void succeedsInValueSet( ValueSetLink pred, ValueSetLink succ) { pred.setSuccessorInValueSet(succ); succ.setPredecessorInValueSet(pred); } - private static void succeedsInMultimap( + private static void succeedsInMultimap( ValueEntry pred, ValueEntry succ) { pred.setSuccessorInMultimap(succ); succ.setPredecessorInMultimap(pred); } - private static void deleteFromValueSet( + private static void deleteFromValueSet( ValueSetLink entry) { succeedsInValueSet(entry.getPredecessorInValueSet(), entry.getSuccessorInValueSet()); } - private static void deleteFromMultimap( + private static void deleteFromMultimap( ValueEntry entry) { succeedsInMultimap(entry.getPredecessorInMultimap(), entry.getSuccessorInMultimap()); } @@ -168,7 +177,8 @@ private interface ValueSetLink + @Immutable + static final class ValueEntry extends ImmutableEntry implements ValueSetLink { final int smearedValueHash; @@ -198,64 +208,64 @@ static final class ValueEntry predecessorInValueSet; - @CheckForNull ValueSetLink successorInValueSet; + @CheckForNull @Assignable ValueSetLink predecessorInValueSet; + @CheckForNull @Assignable ValueSetLink successorInValueSet; - @CheckForNull ValueEntry predecessorInMultimap; - @CheckForNull ValueEntry successorInMultimap; + @CheckForNull @Assignable ValueEntry predecessorInMultimap; + @CheckForNull @Assignable ValueEntry successorInMultimap; ValueEntry( @ParametricNullness K key, @ParametricNullness V value, int smearedValueHash, - @CheckForNull ValueEntry nextInValueBucket) { + @CheckForNull @Immutable ValueEntry nextInValueBucket) { super(key, value); this.smearedValueHash = smearedValueHash; this.nextInValueBucket = nextInValueBucket; } @SuppressWarnings("nullness") // see the comment on the class fields, especially about newHeader - static ValueEntry newHeader() { + static ValueEntry newHeader() { return new ValueEntry<>(null, null, 0, null); } - boolean matchesValue(@CheckForNull Object v, int smearedVHash) { + boolean matchesValue(@CheckForNull @Readonly Object v, int smearedVHash) { return smearedValueHash == smearedVHash && Objects.equal(getValue(), v); } @Override - public ValueSetLink getPredecessorInValueSet() { + public @Immutable ValueSetLink getPredecessorInValueSet() { return requireNonNull(predecessorInValueSet); // see the comment on the class fields } @Override - public ValueSetLink getSuccessorInValueSet() { + public @Immutable ValueSetLink getSuccessorInValueSet() { return requireNonNull(successorInValueSet); // see the comment on the class fields } @Override - public void setPredecessorInValueSet(ValueSetLink entry) { + public void setPredecessorInValueSet(@Immutable ValueSetLink entry) { predecessorInValueSet = entry; } @Override - public void setSuccessorInValueSet(ValueSetLink entry) { + public void setSuccessorInValueSet(@Immutable ValueSetLink entry) { successorInValueSet = entry; } - public ValueEntry getPredecessorInMultimap() { + public @PolyMutable ValueEntry getPredecessorInMultimap(@PolyMutable ValueEntry this) { return requireNonNull(predecessorInMultimap); // see the comment on the class fields } - public ValueEntry getSuccessorInMultimap() { + public @PolyMutable ValueEntry getSuccessorInMultimap(@PolyMutable ValueEntry this) { return requireNonNull(successorInMultimap); // see the comment on the class fields } - public void setSuccessorInMultimap(ValueEntry multimapSuccessor) { + public void setSuccessorInMultimap(@Immutable ValueEntry multimapSuccessor) { this.successorInMultimap = multimapSuccessor; } - public void setPredecessorInMultimap(ValueEntry multimapPredecessor) { + public void setPredecessorInMultimap(@Immutable ValueEntry multimapPredecessor) { this.predecessorInMultimap = multimapPredecessor; } } @@ -268,7 +278,7 @@ public void setPredecessorInMultimap(ValueEntry multimapPredecessor) { private transient ValueEntry multimapHeaderEntry; private LinkedHashMultimap(int keyCapacity, int valueSetCapacity) { - super(Platform.>newLinkedHashMapWithExpectedSize(keyCapacity)); + super(Platform.>newLinkedHashMapWithExpectedSize(keyCapacity)); checkNonnegative(valueSetCapacity, "expectedValuesPerKey"); this.valueSetCapacity = valueSetCapacity; @@ -284,7 +294,7 @@ private LinkedHashMultimap(int keyCapacity, int valueSetCapacity) { * @return a new {@code LinkedHashSet} containing a collection of values for one key */ @Override - Set createCollection() { + Set createCollection(@Readonly LinkedHashMultimap this) { return Platform.newLinkedHashSetWithExpectedSize(valueSetCapacity); } @@ -298,8 +308,8 @@ Set createCollection() { * @return a new decorated set containing a collection of values for one key */ @Override - Collection createCollection(@ParametricNullness K key) { - return new ValueSet(key, valueSetCapacity); + @PolyMutable Collection createCollection(@PolyMutable LinkedHashMultimap this, @ParametricNullness K key) { + return new @PolyMutable ValueSet(key, valueSetCapacity); } /** @@ -311,7 +321,7 @@ Collection createCollection(@ParametricNullness K key) { */ @CanIgnoreReturnValue @Override - public Set replaceValues(@ParametricNullness K key, Iterable values) { + public @Readonly Set replaceValues(@Mutable LinkedHashMultimap this, @ParametricNullness K key, Iterable values) { return super.replaceValues(key, values); } @@ -328,7 +338,7 @@ public Set replaceValues(@ParametricNullness K key, Iterable val */ @SideEffectFree @Override - public Set> entries() { + public @PolyMutable Set> entries(@PolyMutable LinkedHashMultimap this) { return super.entries(); } @@ -343,7 +353,7 @@ public Set> entries() { * adding to the returned set is not possible. */ @Override - public Set keySet() { + public @PolyMutable Set keySet(@PolyMutable LinkedHashMultimap this) { return super.keySet(); } @@ -356,12 +366,13 @@ public Set keySet() { */ @SideEffectFree @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable LinkedHashMultimap this) { return super.values(); } @VisibleForTesting @WeakOuter + @ReceiverDependentMutable final class ValueSet extends Sets.ImprovedAbstractSet implements ValueSetLink { /* * We currently use a fixed load factor of 1.0, a bit higher than normal to reduce memory @@ -387,7 +398,7 @@ final class ValueSet extends Sets.ImprovedAbstractSet implements ValueSetLink @SuppressWarnings({"rawtypes", "unchecked"}) @Nullable - ValueEntry[] hashTable = new @Nullable ValueEntry[tableSize]; + ValueEntry[] hashTable = new @Nullable ValueEntry @ReceiverDependentMutable [tableSize]; this.hashTable = hashTable; } @@ -395,28 +406,29 @@ private int mask() { return hashTable.length - 1; } + @CFComment("PICO: this is okay only if the field can not be directly accessed") @Override - public ValueSetLink getPredecessorInValueSet() { + public @PolyMutable ValueSetLink getPredecessorInValueSet(@PolyMutable ValueSet this) { return lastEntry; } @Override - public ValueSetLink getSuccessorInValueSet() { + public @PolyMutable ValueSetLink getSuccessorInValueSet(@PolyMutable ValueSet this) { return firstEntry; } @Override - public void setPredecessorInValueSet(ValueSetLink entry) { + public void setPredecessorInValueSet(@Mutable ValueSet this, @Mutable ValueSetLink entry) { lastEntry = entry; } @Override - public void setSuccessorInValueSet(ValueSetLink entry) { + public void setSuccessorInValueSet(@Mutable ValueSet this, @Mutable ValueSetLink entry) { firstEntry = entry; } @Override - public Iterator iterator() { + public Iterator iterator(@PolyMutable ValueSet this) { return new Iterator() { ValueSetLink nextEntry = firstEntry; @CheckForNull ValueEntry toRemove; @@ -469,12 +481,12 @@ public void forEach(Consumer action) { } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly ValueSet this) { return size; } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly ValueSet this, @CheckForNull @UnknownSignedness @Readonly Object o) { int smearedHash = Hashing.smearedHash(o); for (ValueEntry entry = hashTable[smearedHash & mask()]; entry != null; @@ -487,7 +499,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object o) { } @Override - public boolean add(@ParametricNullness V value) { + public boolean add(@Mutable ValueSet this, @ParametricNullness V value) { int smearedHash = Hashing.smearedHash(value); int bucket = smearedHash & mask(); ValueEntry rowHead = hashTable[bucket]; @@ -509,7 +521,7 @@ public boolean add(@ParametricNullness V value) { return true; } - private void rehashIfNecessary() { + private void rehashIfNecessary(@Mutable ValueSet this) { if (Hashing.needsResizing(size, hashTable.length, VALUE_SET_LOAD_FACTOR)) { @SuppressWarnings("unchecked") ValueEntry[] hashTable = new ValueEntry[this.hashTable.length * 2]; @@ -528,7 +540,7 @@ private void rehashIfNecessary() { @CanIgnoreReturnValue @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable ValueSet this, @CheckForNull @UnknownSignedness @Readonly Object o) { int smearedHash = Hashing.smearedHash(o); int bucket = smearedHash & mask(); ValueEntry prev = null; @@ -553,7 +565,7 @@ public boolean remove(@CheckForNull @UnknownSignedness Object o) { } @Override - public void clear() { + public void clear(@Mutable ValueSet this) { Arrays.fill(hashTable, null); size = 0; for (ValueSetLink entry = firstEntry; @@ -568,8 +580,8 @@ public void clear() { } @Override - Iterator> entryIterator() { - return new Iterator>() { + Iterator<@PolyMutable Entry> entryIterator(@PolyMutable LinkedHashMultimap this) { + return new Iterator<@PolyMutable Entry>() { ValueEntry nextEntry = multimapHeaderEntry.getSuccessorInMultimap(); @CheckForNull ValueEntry toRemove; @@ -599,22 +611,22 @@ public void remove() { } @Override - Spliterator> entrySpliterator() { + Spliterator<@PolyMutable Entry> entrySpliterator(@PolyMutable LinkedHashMultimap this) { return Spliterators.spliterator(entries(), Spliterator.DISTINCT | Spliterator.ORDERED); } @Override - Iterator valueIterator() { + Iterator valueIterator(@PolyMutable LinkedHashMultimap this) { return Maps.valueIterator(entryIterator()); } @Override - Spliterator valueSpliterator() { + Spliterator valueSpliterator(@PolyMutable LinkedHashMultimap this) { return CollectSpliterators.map(entrySpliterator(), Entry::getValue); } @Override - public void clear() { + public void clear(@Mutable LinkedHashMultimap this) { super.clear(); succeedsInMultimap(multimapHeaderEntry, multimapHeaderEntry); } @@ -669,8 +681,8 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo private static final long serialVersionUID = 1; @Override -public boolean equals(@Nullable Object arg0) { return super.equals(arg0); } +public boolean equals(@Readonly LinkedHashMultimap this, @Nullable @Readonly Object arg0) { return super.equals(arg0); } @Override -public Set removeAll(@Nullable Object arg0) { return super.removeAll(arg0); } +public @Readonly Set removeAll(@Mutable LinkedHashMultimap this, @Nullable @Readonly Object arg0) { return super.removeAll(arg0); } } diff --git a/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java b/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java index bb4a2e490e45..ee65065bd121 100644 --- a/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java +++ b/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java @@ -19,6 +19,9 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A dummy superclass to support GWT serialization of the element types of a {@link @@ -29,10 +32,12 @@ * *

TODO(cpovirk): Consider applying this subclass approach to our other types. */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) -abstract class LinkedHashMultimapGwtSerializationDependencies +@ReceiverDependentMutable +abstract class LinkedHashMultimapGwtSerializationDependencies extends AbstractSetMultimap { - LinkedHashMultimapGwtSerializationDependencies(Map> map) { + LinkedHashMultimapGwtSerializationDependencies(@ReceiverDependentMutable Map> map) { super(map); } } diff --git a/guava/src/com/google/common/collect/LinkedHashMultiset.java b/guava/src/com/google/common/collect/LinkedHashMultiset.java index 18192831e65c..3e066b2b1016 100644 --- a/guava/src/com/google/common/collect/LinkedHashMultiset.java +++ b/guava/src/com/google/common/collect/LinkedHashMultiset.java @@ -25,6 +25,9 @@ import java.util.LinkedHashMap; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -46,11 +49,12 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public final class LinkedHashMultiset +@ReceiverDependentMutable +public final class LinkedHashMultiset extends AbstractMapBasedMultiset { /** Creates a new, empty {@code LinkedHashMultiset} using the default initial capacity. */ - public static LinkedHashMultiset create() { + public static LinkedHashMultiset create() { return new LinkedHashMultiset(); } @@ -61,7 +65,7 @@ public final class LinkedHashMultiset * @param distinctElements the expected number of distinct elements * @throws IllegalArgumentException if {@code distinctElements} is negative */ - public static LinkedHashMultiset create(int distinctElements) { + public static LinkedHashMultiset create(int distinctElements) { return new LinkedHashMultiset(distinctElements); } @@ -72,7 +76,7 @@ public final class LinkedHashMultiset * * @param elements the elements that the multiset should contain */ - public static LinkedHashMultiset create( + public static LinkedHashMultiset create( Iterable elements) { LinkedHashMultiset multiset = create(Multisets.inferDistinctElements(elements)); Iterables.addAll(multiset, elements); @@ -110,15 +114,15 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo @Pure @Override - public boolean contains(@Nullable @UnknownSignedness Object arg0) { return super.contains(arg0); } + public boolean contains(@Nullable @UnknownSignedness @Readonly Object arg0) { return super.contains(arg0); } @Override - public @NonNegative int count(@Nullable @UnknownSignedness Object arg0) { return super.count(arg0); } + public @NonNegative int count(@Nullable @UnknownSignedness @Readonly Object arg0) { return super.count(arg0); } @Override - public int remove(@Nullable Object arg0, int arg1) { return super.remove(arg0, arg1); } + public int remove(@Nullable @Readonly Object arg0, int arg1) { return super.remove(arg0, arg1); } @Pure @Override - public boolean containsAll(Collection arg0) { return super.containsAll(arg0); } + public boolean containsAll(@Readonly Collection arg0) { return super.containsAll(arg0); } } diff --git a/guava/src/com/google/common/collect/LinkedListMultimap.java b/guava/src/com/google/common/collect/LinkedListMultimap.java index 680b9e61d08c..1f725506033a 100644 --- a/guava/src/com/google/common/collect/LinkedListMultimap.java +++ b/guava/src/com/google/common/collect/LinkedListMultimap.java @@ -44,6 +44,11 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -103,7 +108,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public class LinkedListMultimap +@ReceiverDependentMutable +public class LinkedListMultimap extends AbstractMultimap implements ListMultimap, Serializable { /* * Order is maintained using a linked list containing all key-value pairs. In @@ -112,7 +118,8 @@ public class LinkedListMultimap + @ReceiverDependentMutable + private static final class Node extends AbstractMapEntry { @ParametricNullness final K key; @ParametricNullness V value; @@ -147,7 +154,7 @@ public V setValue(@ParametricNullness V newValue) { } } - private static class KeyList { + @ReceiverDependentMutable private static class KeyList { Node head; Node tail; int count; @@ -174,7 +181,7 @@ private static class KeyList + public static LinkedListMultimap create() { return new LinkedListMultimap<>(); } @@ -186,7 +193,7 @@ LinkedListMultimap create() { * @param expectedKeys the expected number of distinct keys * @throws IllegalArgumentException if {@code expectedKeys} is negative */ - public static + public static LinkedListMultimap create(int expectedKeys) { return new LinkedListMultimap<>(expectedKeys); } @@ -198,7 +205,7 @@ LinkedListMultimap create(int expectedKeys) { * * @param multimap the multimap whose contents are copied to this multimap */ - public static + public static LinkedListMultimap create(Multimap multimap) { return new LinkedListMultimap<>(multimap); } @@ -223,6 +230,7 @@ private LinkedListMultimap(Multimap multimap) { */ @CanIgnoreReturnValue private Node addNode( + @Mutable LinkedListMultimap this, @ParametricNullness K key, @ParametricNullness V value, @CheckForNull Node nextSibling) { @@ -280,7 +288,7 @@ private Node addNode( * Removes the specified node from the linked list. This method is only intended to be used from * the {@code Iterator} classes. See also {@link LinkedListMultimap#removeAllNodes(Object)}. */ - private void removeNode(Node node) { + private void removeNode(@Mutable LinkedListMultimap this, @Readonly Node node) { if (node.previous != null) { node.previous.next = node.next; } else { // node was head @@ -323,16 +331,17 @@ private void removeNode(Node node) { } /** Removes all nodes for the specified key. */ - private void removeAllNodes(@ParametricNullness K key) { + private void removeAllNodes(@Mutable LinkedListMultimap this, @ParametricNullness K key) { Iterators.clear(new ValueForKeyIterator(key)); } /** An {@code Iterator} over all nodes. */ + @ReceiverDependentMutable private class NodeIterator implements ListIterator> { int nextIndex; - @CheckForNull Node next; - @CheckForNull Node current; - @CheckForNull Node previous; + @CheckForNull @Assignable Node next; + @CheckForNull @Assignable Node current; + @CheckForNull @Assignable Node previous; int expectedModCount = modCount; NodeIterator(int index) { @@ -379,7 +388,7 @@ public Node next() { } @Override - public void remove() { + public void remove(@Mutable NodeIterator this) { checkForConcurrentModification(); checkState(current != null, "no calls to next() since the last call to remove()"); if (current != next) { // after call to next() @@ -423,12 +432,12 @@ public Node previous() { } @Override - public void set(Entry e) { + public void set(@Mutable NodeIterator this, Entry e) { throw new UnsupportedOperationException(); } @Override - public void add(Entry e) { + public void add(@Mutable NodeIterator this, Entry e) { throw new UnsupportedOperationException(); } @@ -439,10 +448,10 @@ void setValue(@ParametricNullness V value) { } /** An {@code Iterator} over distinct keys in key head order. */ - private class DistinctKeyIterator implements Iterator { + @ReceiverDependentMutable private class DistinctKeyIterator implements Iterator { final Set seenKeys = Sets.newHashSetWithExpectedSize(keySet().size()); - @CheckForNull Node next = head; - @CheckForNull Node current; + @CheckForNull @Assignable Node next = head; + @CheckForNull @Assignable Node current; int expectedModCount = modCount; private void checkForConcurrentModification() { @@ -486,9 +495,9 @@ public void remove() { private class ValueForKeyIterator implements ListIterator { @ParametricNullness final K key; int nextIndex; - @CheckForNull Node next; - @CheckForNull Node current; - @CheckForNull Node previous; + @CheckForNull @Assignable Node next; + @CheckForNull @Assignable Node current; + @CheckForNull @Assignable Node previous; /** Constructs a new iterator over all values for the specified key. */ ValueForKeyIterator(@ParametricNullness K key) { @@ -635,7 +644,7 @@ public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { */ @CanIgnoreReturnValue @Override - public boolean put(@ParametricNullness K key, @ParametricNullness V value) { + public boolean put(@Mutable LinkedListMultimap this, @ParametricNullness K key, @ParametricNullness V value) { addNode(key, value, null); return true; } @@ -652,7 +661,7 @@ public boolean put(@ParametricNullness K key, @ParametricNullness V value) { */ @CanIgnoreReturnValue @Override - public List replaceValues(@ParametricNullness K key, Iterable values) { + public List replaceValues(@Mutable LinkedListMultimap this, @ParametricNullness K key, Iterable values) { List oldValues = getCopy(key); ListIterator keyValues = new ValueForKeyIterator(key); Iterator newValues = values.iterator(); @@ -688,7 +697,7 @@ private List getCopy(@ParametricNullness K key) { */ @CanIgnoreReturnValue @Override - public List removeAll(@Nullable Object key) { + public List removeAll(@Mutable LinkedListMultimap this, @Nullable @Readonly Object key) { /* * Safe because all we do is remove values for the key, not add them. (If we wanted to make sure * to call getCopy and removeAllNodes only with a true K, then we could check containsKey first. @@ -702,7 +711,7 @@ public List removeAll(@Nullable Object key) { } @Override - public void clear() { + public void clear(@Mutable LinkedListMultimap this) { head = null; tail = null; keyToKeyList.clear(); @@ -912,8 +921,8 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo public boolean equals(@Nullable Object arg0) { return super.equals(arg0); } @Override -public boolean remove(@Nullable Object arg0, @Nullable Object arg1) { return super.remove(arg0, arg1); } +public boolean remove(@Mutable LinkedListMultimap this, @Nullable @Readonly Object arg0, @Nullable @Readonly Object arg1) { return super.remove(arg0, arg1); } @Override -public Map> asMap() { return super.asMap(); } +public @ReceiverDependentMutable Map> asMap() { return super.asMap(); } } diff --git a/guava/src/com/google/common/collect/ListMultimap.java b/guava/src/com/google/common/collect/ListMultimap.java index 1dd9917d9229..f0708a191a37 100644 --- a/guava/src/com/google/common/collect/ListMultimap.java +++ b/guava/src/com/google/common/collect/ListMultimap.java @@ -23,6 +23,11 @@ import java.util.Map; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -44,7 +49,8 @@ @GwtCompatible @AnnotatedFor({"nullness"}) @ElementTypesAreNonnullByDefault -public interface ListMultimap +@ReceiverDependentMutable +public interface ListMultimap extends Multimap { /** * {@inheritDoc} @@ -54,7 +60,7 @@ public interface ListMultimap get(@ParametricNullness K key); + @ReceiverDependentMutable List get(@Readonly ListMultimap this, @ParametricNullness K key); /** * {@inheritDoc} @@ -65,7 +71,7 @@ public interface ListMultimap removeAll(@CheckForNull Object key); + @ReceiverDependentMutable List removeAll(@Mutable ListMultimap this, @CheckForNull @Readonly Object key); /** * {@inheritDoc} @@ -76,7 +82,7 @@ public interface ListMultimap replaceValues(@ParametricNullness K key, Iterable values); + @ReceiverDependentMutable List replaceValues(@Mutable ListMultimap this, @ParametricNullness K key, Iterable values); /** * {@inheritDoc} @@ -86,7 +92,7 @@ public interface ListMultimap> asMap(); + @PolyMutable Map> asMap(@PolyMutable ListMultimap this); /** * Compares the specified object to this multimap for equality. @@ -99,5 +105,5 @@ public interface ListMultimap this, @CheckForNull @Readonly Object obj); } diff --git a/guava/src/com/google/common/collect/Lists.java b/guava/src/com/google/common/collect/Lists.java index 3e3df72119cb..f2b20610187b 100644 --- a/guava/src/com/google/common/collect/Lists.java +++ b/guava/src/com/google/common/collect/Lists.java @@ -52,6 +52,11 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -68,7 +73,7 @@ * @author Louis Wasserman * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault public final class Lists { @@ -86,7 +91,7 @@ private Lists() {} * advantage of "diamond" syntax. */ @GwtCompatible(serializable = true) - public static ArrayList newArrayList() { + public static ArrayList newArrayList() { return new ArrayList<>(); } @@ -106,7 +111,7 @@ private Lists() {} */ @SafeVarargs @GwtCompatible(serializable = true) - public static ArrayList newArrayList(E... elements) { + public static ArrayList newArrayList(E... elements) { checkNotNull(elements); // for GWT // Avoid integer overflow when a large array is passed in int capacity = computeArrayListCapacity(elements.length); @@ -128,7 +133,7 @@ private Lists() {} * advantage of "diamond" syntax. */ @GwtCompatible(serializable = true) - public static ArrayList newArrayList( + public static ArrayList newArrayList( Iterable elements) { checkNotNull(elements); // for GWT // Let ArrayList's sizing logic work, if possible @@ -145,7 +150,7 @@ private Lists() {} * ImmutableList#copyOf(Iterator)} instead. */ @GwtCompatible(serializable = true) - public static ArrayList newArrayList( + public static ArrayList newArrayList( Iterator elements) { ArrayList list = newArrayList(); Iterators.addAll(list, elements); @@ -177,7 +182,7 @@ static int computeArrayListCapacity(int arraySize) { * @throws IllegalArgumentException if {@code initialArraySize} is negative */ @GwtCompatible(serializable = true) - public static ArrayList newArrayListWithCapacity( + public static ArrayList newArrayListWithCapacity( int initialArraySize) { checkNonnegative(initialArraySize, "initialArraySize"); // for GWT. return new ArrayList<>(initialArraySize); @@ -197,7 +202,7 @@ static int computeArrayListCapacity(int arraySize) { * @throws IllegalArgumentException if {@code estimatedSize} is negative */ @GwtCompatible(serializable = true) - public static ArrayList newArrayListWithExpectedSize( + public static ArrayList newArrayListWithExpectedSize( int estimatedSize) { return new ArrayList<>(computeArrayListCapacity(estimatedSize)); } @@ -219,7 +224,7 @@ static int computeArrayListCapacity(int arraySize) { * advantage of "diamond" syntax. */ @GwtCompatible(serializable = true) - public static LinkedList newLinkedList() { + public static LinkedList newLinkedList() { return new LinkedList<>(); } @@ -240,7 +245,7 @@ static int computeArrayListCapacity(int arraySize) { * taking advantage of "diamond" syntax. */ @GwtCompatible(serializable = true) - public static LinkedList newLinkedList( + public static LinkedList newLinkedList( Iterable elements) { LinkedList list = newLinkedList(); Iterables.addAll(list, elements); @@ -257,7 +262,7 @@ static int computeArrayListCapacity(int arraySize) { * @since 12.0 */ @GwtIncompatible // CopyOnWriteArrayList - public static CopyOnWriteArrayList newCopyOnWriteArrayList() { + public static CopyOnWriteArrayList newCopyOnWriteArrayList() { return new CopyOnWriteArrayList<>(); } @@ -269,7 +274,7 @@ static int computeArrayListCapacity(int arraySize) { * @since 12.0 */ @GwtIncompatible // CopyOnWriteArrayList - public static CopyOnWriteArrayList newCopyOnWriteArrayList( + public static CopyOnWriteArrayList newCopyOnWriteArrayList( Iterable elements) { // We copy elements to an ArrayList first, rather than incurring the // quadratic cost of adding them to the COWAL directly. @@ -294,7 +299,7 @@ static int computeArrayListCapacity(int arraySize) { * @param rest an array of additional elements, possibly empty * @return an unmodifiable list containing the specified elements */ - public static List asList(@ParametricNullness E first, E[] rest) { + public static List asList(@ParametricNullness E first, E[] rest) { return new OnePlusArrayList<>(first, rest); } @@ -314,31 +319,32 @@ static int computeArrayListCapacity(int arraySize) { * @param rest an array of additional elements, possibly empty * @return an unmodifiable list containing the specified elements */ - public static List asList( + public static List asList( @ParametricNullness E first, @ParametricNullness E second, E[] rest) { return new TwoPlusArrayList<>(first, second, rest); } /** @see Lists#asList(Object, Object[]) */ - private static class OnePlusArrayList extends AbstractList + @ReceiverDependentMutable + private static class OnePlusArrayList extends AbstractList implements Serializable, RandomAccess { @ParametricNullness final E first; final E[] rest; - OnePlusArrayList(@ParametricNullness E first, E[] rest) { + OnePlusArrayList(@ParametricNullness E first, E @ReceiverDependentMutable [] rest) { this.first = first; this.rest = checkNotNull(rest); } @Pure @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly OnePlusArrayList this) { return IntMath.saturatedAdd(rest.length, 1); } @Override @ParametricNullness - public E get(int index) { + public E get(@Readonly OnePlusArrayList this, int index) { // check explicitly so the IOOBE will have the right message checkElementIndex(index, size()); return (index == 0) ? first : rest[index - 1]; @@ -348,13 +354,14 @@ public E get(int index) { } /** @see Lists#asList(Object, Object, Object[]) */ - private static class TwoPlusArrayList extends AbstractList + @ReceiverDependentMutable + private static class TwoPlusArrayList extends AbstractList implements Serializable, RandomAccess { @ParametricNullness final E first; @ParametricNullness final E second; final E[] rest; - TwoPlusArrayList(@ParametricNullness E first, @ParametricNullness E second, E[] rest) { + TwoPlusArrayList(@ParametricNullness E first, @ParametricNullness E second, E @ReceiverDependentMutable [] rest) { this.first = first; this.second = second; this.rest = checkNotNull(rest); @@ -362,13 +369,13 @@ private static class TwoPlusArrayList extends Abstra @Pure @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly TwoPlusArrayList this) { return IntMath.saturatedAdd(rest.length, 2); } @Override @ParametricNullness - public E get(int index) { + public E get(@Readonly TwoPlusArrayList this, int index) { switch (index) { case 0: return first; @@ -438,7 +445,7 @@ public E get(int index) { * a provided list is null * @since 19.0 */ - public static List> cartesianProduct(List> lists) { + public static List<@Readonly List> cartesianProduct(List> lists) { return CartesianList.create(lists); } @@ -497,7 +504,7 @@ public static List> cartesianProduct(List List> cartesianProduct(List... lists) { + public static List<@Readonly List> cartesianProduct(List... lists) { return cartesianProduct(Arrays.asList(lists)); } @@ -533,11 +540,11 @@ public static List> cartesianProduct(List... lists) { * java.util.stream.Stream#map}. This method is not being deprecated, but we gently encourage you * to migrate to streams. */ - public static List transform( - List fromList, Function function) { + public static List transform( + @PolyMutable List fromList, Function function) { return (fromList instanceof RandomAccess) - ? new TransformingRandomAccessList<>(fromList, function) - : new TransformingSequentialList<>(fromList, function); + ? new @PolyMutable TransformingRandomAccessList<>(fromList, function) + : new @PolyMutable TransformingSequentialList<>(fromList, function); } /** @@ -545,13 +552,14 @@ public static List> cartesianProduct(List... lists) { * * @see Lists#transform */ + @ReceiverDependentMutable private static class TransformingSequentialList< - F extends @Nullable Object, T extends @Nullable Object> + F extends @Nullable @Readonly Object, T extends @Nullable @Readonly Object> extends AbstractSequentialList implements Serializable { final List fromList; final Function function; - TransformingSequentialList(List fromList, Function function) { + TransformingSequentialList(@ReceiverDependentMutable List fromList, Function function) { this.fromList = checkNotNull(fromList); this.function = checkNotNull(function); } @@ -561,18 +569,18 @@ private static class TransformingSequentialList< * can be overkill. That's why we forward this call directly to the backing list. */ @Override - public void clear() { + public void clear(@Mutable TransformingSequentialList this) { fromList.clear(); } @Pure @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly TransformingSequentialList this) { return fromList.size(); } @Override - public ListIterator listIterator(final int index) { + public ListIterator listIterator(@Readonly TransformingSequentialList this, final int index) { return new TransformedListIterator(fromList.listIterator(index)) { @Override @ParametricNullness @@ -583,7 +591,7 @@ T transform(@ParametricNullness F from) { } @Override - public boolean removeIf(Predicate filter) { + public boolean removeIf(@Mutable TransformingSequentialList this, Predicate filter) { checkNotNull(filter); return fromList.removeIf(element -> filter.test(function.apply(element))); } @@ -598,35 +606,36 @@ public boolean removeIf(Predicate filter) { * * @see Lists#transform */ + @ReceiverDependentMutable private static class TransformingRandomAccessList< - F extends @Nullable Object, T extends @Nullable Object> + F extends @Nullable @Readonly Object, T extends @Nullable @Readonly Object> extends AbstractList implements RandomAccess, Serializable { final List fromList; final Function function; - TransformingRandomAccessList(List fromList, Function function) { + TransformingRandomAccessList(@ReceiverDependentMutable List fromList, Function function) { this.fromList = checkNotNull(fromList); this.function = checkNotNull(function); } @Override - public void clear() { + public void clear(@Mutable TransformingRandomAccessList this) { fromList.clear(); } @Override @ParametricNullness - public T get(int index) { + public T get(@Readonly TransformingRandomAccessList this, int index) { return function.apply(fromList.get(index)); } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly TransformingRandomAccessList this) { return listIterator(); } @Override - public ListIterator listIterator(int index) { + public ListIterator listIterator(@Readonly TransformingRandomAccessList this, int index) { return new TransformedListIterator(fromList.listIterator(index)) { @Override T transform(F from) { @@ -637,25 +646,25 @@ T transform(F from) { @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly TransformingRandomAccessList this) { return fromList.isEmpty(); } @Override - public boolean removeIf(Predicate filter) { + public boolean removeIf(@Mutable TransformingRandomAccessList this, Predicate filter) { checkNotNull(filter); return fromList.removeIf(element -> filter.test(function.apply(element))); } @Override @ParametricNullness - public T remove(int index) { + public T remove(@Mutable TransformingRandomAccessList this, int index) { return function.apply(fromList.remove(index)); } @Pure @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly TransformingRandomAccessList this) { return fromList.size(); } @@ -677,7 +686,7 @@ public T remove(int index) { * @return a list of consecutive sublists * @throws IllegalArgumentException if {@code partitionSize} is nonpositive */ - public static List> partition(List list, int size) { + public static List> partition(List list, int size) { checkNotNull(list); checkArgument(size > 0); return (list instanceof RandomAccess) @@ -685,17 +694,18 @@ public T remove(int index) { : new Partition<>(list, size); } - private static class Partition extends AbstractList> { + @ReceiverDependentMutable + private static class Partition extends AbstractList> { final List list; final int size; - Partition(List list, int size) { + Partition(@ReceiverDependentMutable List list, int size) { this.list = list; this.size = size; } @Override - public List get(int index) { + public List get(@Readonly Partition this, int index) { checkElementIndex(index, size()); int start = index * size; int end = Math.min(start + size, list.size()); @@ -704,20 +714,21 @@ public List get(int index) { @Pure @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly Partition this) { return IntMath.divide(list.size(), size, RoundingMode.CEILING); } @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly Partition this) { return list.isEmpty(); } } - private static class RandomAccessPartition extends Partition + @ReceiverDependentMutable + private static class RandomAccessPartition extends Partition implements RandomAccess { - RandomAccessPartition(List list, int size) { + RandomAccessPartition(@ReceiverDependentMutable List list, int size) { super(list, size); } } @@ -746,6 +757,7 @@ public static List charactersOf(CharSequence sequence) { } @SuppressWarnings("serial") // serialized using ImmutableList serialization + @Immutable private static final class StringAsImmutableList extends ImmutableList { private final String string; @@ -755,12 +767,12 @@ private static final class StringAsImmutableList extends ImmutableList { private final CharSequence sequence; @@ -795,13 +808,13 @@ private static final class CharSequenceAsList extends AbstractList { } @Override - public Character get(int index) { + public Character get(@Readonly CharSequenceAsList this, int index) { checkElementIndex(index, size()); // for GWT return sequence.charAt(index); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly CharSequenceAsList this) { return sequence.length(); } } @@ -817,7 +830,7 @@ public Character get(int index) { * * @since 7.0 */ - public static List reverse(List list) { + public static List reverse(List list) { if (list instanceof ImmutableList) { // Avoid nullness warnings. List reversed = ((ImmutableList) list).reverse(); @@ -833,80 +846,81 @@ public Character get(int index) { } } - private static class ReverseList extends AbstractList { + @ReceiverDependentMutable + private static class ReverseList extends AbstractList { private final List forwardList; - ReverseList(List forwardList) { + ReverseList(@ReceiverDependentMutable List forwardList) { this.forwardList = checkNotNull(forwardList); } - List getForwardList() { + @PolyMutable List getForwardList(@PolyMutable ReverseList this) { return forwardList; } - private int reverseIndex(int index) { + private int reverseIndex(@Readonly ReverseList this, int index) { int size = size(); checkElementIndex(index, size); return (size - 1) - index; } - private int reversePosition(int index) { + private int reversePosition(@Readonly ReverseList this, int index) { int size = size(); checkPositionIndex(index, size); return size - index; } @Override - public void add(int index, @ParametricNullness T element) { + public void add(@Mutable ReverseList this, int index, @ParametricNullness T element) { forwardList.add(reversePosition(index), element); } @Override - public void clear() { + public void clear(@Mutable ReverseList this) { forwardList.clear(); } @Override @ParametricNullness - public T remove(int index) { + public T remove(@Mutable ReverseList this, int index) { return forwardList.remove(reverseIndex(index)); } @Override - protected void removeRange(int fromIndex, int toIndex) { + protected void removeRange(@Mutable ReverseList this, int fromIndex, int toIndex) { subList(fromIndex, toIndex).clear(); } @Override @ParametricNullness - public T set(int index, @ParametricNullness T element) { + public T set(@Mutable ReverseList this, int index, @ParametricNullness T element) { return forwardList.set(reverseIndex(index), element); } @Override @ParametricNullness - public T get(int index) { + public T get(@Readonly ReverseList this, int index) { return forwardList.get(reverseIndex(index)); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly ReverseList this) { return forwardList.size(); } @Override - public List subList(int fromIndex, int toIndex) { + public @PolyMutable List subList(@PolyMutable ReverseList this, int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); return reverse(forwardList.subList(reversePosition(toIndex), reversePosition(fromIndex))); } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly ReverseList this) { return listIterator(); } @Override - public ListIterator listIterator(int index) { + public ListIterator listIterator(@Readonly ReverseList this, int index) { int start = reversePosition(index); final ListIterator forwardIterator = forwardList.listIterator(start); return new ListIterator() { @@ -976,15 +990,16 @@ public void set(@ParametricNullness T e) { } } - private static class RandomAccessReverseList extends ReverseList + @ReceiverDependentMutable + private static class RandomAccessReverseList extends ReverseList implements RandomAccess { - RandomAccessReverseList(List forwardList) { + RandomAccessReverseList(@ReceiverDependentMutable List forwardList) { super(forwardList); } } /** An implementation of {@link List#hashCode()}. */ - static int hashCodeImpl(List list) { + static int hashCodeImpl(@Readonly List list) { // TODO(lowasser): worth optimizing for RandomAccess? int hashCode = 1; for (Object o : list) { @@ -997,7 +1012,7 @@ static int hashCodeImpl(List list) { } /** An implementation of {@link List#equals(Object)}. */ - static boolean equalsImpl(List thisList, @CheckForNull @UnknownSignedness Object other) { + static boolean equalsImpl(@Readonly List thisList, @CheckForNull @UnknownSignedness @Readonly Object other) { if (other == checkNotNull(thisList)) { return true; } @@ -1023,8 +1038,8 @@ static boolean equalsImpl(List thisList, @CheckForNull @UnknownSignedness Obj } /** An implementation of {@link List#addAll(int, Collection)}. */ - static boolean addAllImpl( - List list, int index, Iterable elements) { + static boolean addAllImpl( + @Readonly List list, int index, Iterable elements) { boolean changed = false; ListIterator listIterator = list.listIterator(index); for (E e : elements) { @@ -1035,7 +1050,7 @@ static boolean equalsImpl(List thisList, @CheckForNull @UnknownSignedness Obj } /** An implementation of {@link List#indexOf(Object)}. */ - static int indexOfImpl(List list, @CheckForNull @UnknownSignedness Object element) { + static int indexOfImpl(@Readonly List list, @CheckForNull @UnknownSignedness @Readonly Object element) { if (list instanceof RandomAccess) { return indexOfRandomAccess(list, element); } else { @@ -1049,7 +1064,7 @@ static int indexOfImpl(List list, @CheckForNull @UnknownSignedness Object ele } } - private static int indexOfRandomAccess(List list, @CheckForNull Object element) { + private static int indexOfRandomAccess(@Readonly List list, @CheckForNull @Readonly Object element) { int size = list.size(); if (element == null) { for (int i = 0; i < size; i++) { @@ -1068,7 +1083,7 @@ private static int indexOfRandomAccess(List list, @CheckForNull Object elemen } /** An implementation of {@link List#lastIndexOf(Object)}. */ - static int lastIndexOfImpl(List list, @CheckForNull @UnknownSignedness Object element) { + static int lastIndexOfImpl(@Readonly List list, @CheckForNull @UnknownSignedness @Readonly Object element) { if (list instanceof RandomAccess) { return lastIndexOfRandomAccess(list, element); } else { @@ -1082,7 +1097,7 @@ static int lastIndexOfImpl(List list, @CheckForNull @UnknownSignedness Object } } - private static int lastIndexOfRandomAccess(List list, @CheckForNull Object element) { + private static int lastIndexOfRandomAccess(@Readonly List list, @CheckForNull @Readonly Object element) { if (element == null) { for (int i = list.size() - 1; i >= 0; i--) { if (list.get(i) == null) { @@ -1100,12 +1115,12 @@ private static int lastIndexOfRandomAccess(List list, @CheckForNull Object el } /** Returns an implementation of {@link List#listIterator(int)}. */ - static ListIterator listIteratorImpl(List list, int index) { + static ListIterator listIteratorImpl(List list, int index) { return new AbstractListWrapper<>(list).listIterator(index); } /** An implementation of {@link List#subList(int, int)}. */ - static List subListImpl( + static List subListImpl( final List list, int fromIndex, int toIndex) { List wrapper; if (list instanceof RandomAccess) { @@ -1132,61 +1147,63 @@ public ListIterator listIterator(int index) { return wrapper.subList(fromIndex, toIndex); } - private static class AbstractListWrapper extends AbstractList { + @ReceiverDependentMutable + private static class AbstractListWrapper extends AbstractList { final List backingList; - AbstractListWrapper(List backingList) { + AbstractListWrapper(@ReceiverDependentMutable List backingList) { this.backingList = checkNotNull(backingList); } @Override - public void add(int index, @ParametricNullness E element) { + public void add(@Mutable AbstractListWrapper this, int index, @ParametricNullness E element) { backingList.add(index, element); } @Override - public boolean addAll(int index, Collection c) { + public boolean addAll(@Mutable AbstractListWrapper this, int index, @Readonly Collection c) { return backingList.addAll(index, c); } @Override @ParametricNullness - public E get(int index) { + public E get(@Readonly AbstractListWrapper this, int index) { return backingList.get(index); } @Override @ParametricNullness - public E remove(int index) { + public E remove(@Mutable AbstractListWrapper this, int index) { return backingList.remove(index); } @Override @ParametricNullness - public E set(int index, @ParametricNullness E element) { + public E set(@Mutable AbstractListWrapper this, int index, @ParametricNullness E element) { return backingList.set(index, element); } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly AbstractListWrapper this, @CheckForNull @UnknownSignedness @Readonly Object o) { return backingList.contains(o); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly AbstractListWrapper this) { return backingList.size(); } } - private static class RandomAccessListWrapper + @ReceiverDependentMutable + private static class RandomAccessListWrapper extends AbstractListWrapper implements RandomAccess { - RandomAccessListWrapper(List backingList) { + RandomAccessListWrapper(@ReceiverDependentMutable List backingList) { super(backingList); } } /** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */ - static List cast(Iterable iterable) { + static List cast(Iterable iterable) { return (List) iterable; } } diff --git a/guava/src/com/google/common/collect/MapDifference.java b/guava/src/com/google/common/collect/MapDifference.java index d6f2f0b4947b..61d6812c63b7 100644 --- a/guava/src/com/google/common/collect/MapDifference.java +++ b/guava/src/com/google/common/collect/MapDifference.java @@ -21,6 +21,8 @@ import java.util.Map; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -35,7 +37,7 @@ @GwtCompatible @AnnotatedFor({"nullness"}) @ElementTypesAreNonnullByDefault -public interface MapDifference { +public interface MapDifference { /** * Returns {@code true} if there are no differences between the two maps; that is, if the maps are * equal. @@ -95,7 +97,7 @@ public interface MapDifference { + interface ValueDifference { /** Returns the value from the left map (possibly null). */ @ParametricNullness V leftValue(); diff --git a/guava/src/com/google/common/collect/MapMaker.java b/guava/src/com/google/common/collect/MapMaker.java index 7f68df0aee19..9b6830b6c83b 100644 --- a/guava/src/com/google/common/collect/MapMaker.java +++ b/guava/src/com/google/common/collect/MapMaker.java @@ -33,6 +33,7 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -281,7 +282,7 @@ Strength getValueStrength() { * * @return a serializable concurrent map having the requested features */ - public ConcurrentMap makeMap() { + public ConcurrentMap makeMap() { if (!useCustomMap) { return new ConcurrentHashMap<>(getInitialCapacity(), 0.75f, getConcurrencyLevel()); } diff --git a/guava/src/com/google/common/collect/MapMakerInternalMap.java b/guava/src/com/google/common/collect/MapMakerInternalMap.java index b4b1c8bc7a61..55c1e54694d1 100644 --- a/guava/src/com/google/common/collect/MapMakerInternalMap.java +++ b/guava/src/com/google/common/collect/MapMakerInternalMap.java @@ -23,6 +23,7 @@ import com.google.common.collect.MapMaker.Dummy; import com.google.common.primitives.Ints; import com.google.errorprone.annotations.CanIgnoreReturnValue; +//import com.google.errorprone.annotations.Immutable; import com.google.errorprone.annotations.concurrent.GuardedBy; import com.google.j2objc.annotations.Weak; import com.google.j2objc.annotations.WeakOuter; @@ -51,6 +52,10 @@ import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.framework.qual.CFComment; @@ -76,8 +81,9 @@ "nullness", // too much trouble for the payoff }) // TODO(cpovirk): Annotate for nullness. +@ReceiverDependentMutable class MapMakerInternalMap< - K, + K extends @Immutable Object, V, E extends MapMakerInternalMap.InternalEntry, S extends MapMakerInternalMap.Segment> @@ -159,7 +165,7 @@ class MapMakerInternalMap< final int concurrencyLevel; /** Strategy for comparing keys. */ - final Equivalence keyEquivalence; + final Equivalence<@Readonly Object> keyEquivalence; /** Strategy for handling entries and segments in a type-safe and efficient manner. */ final transient InternalEntryHelper entryHelper; @@ -204,7 +210,7 @@ private MapMakerInternalMap(MapMaker builder, InternalEntryHelper en } /** Returns a fresh {@link MapMakerInternalMap} as specified by the given {@code builder}. */ - static MapMakerInternalMap, ?> create( + static MapMakerInternalMap, ?> create( MapMaker builder) { if (builder.getKeyStrength() == Strength.STRONG && builder.getValueStrength() == Strength.STRONG) { @@ -234,7 +240,7 @@ private MapMakerInternalMap(MapMaker builder, InternalEntryHelper en *

This method is intended to only be used by the internal implementation of {@link Interners}, * since a map of dummy values is the exact use case there. */ - static + static MapMakerInternalMap, ?> createWithDummyValues( MapMaker builder) { if (builder.getKeyStrength() == Strength.STRONG @@ -287,8 +293,9 @@ Equivalence defaultEquivalence() { * @param the type of the {@link InternalEntry} entry implementation * @param the type of the {@link Segment} entry implementation */ + @ReceiverDependentMutable interface InternalEntryHelper< - K, V, E extends InternalEntry, S extends Segment> { + K extends @Immutable Object, V, E extends @Readonly InternalEntry, S extends Segment> { /** The strength of the key type in each entry. */ Strength keyStrength(); @@ -325,7 +332,8 @@ interface InternalEntryHelper< * *

Invalid: - Collected: key/value was partially collected, but not yet cleaned up */ - interface InternalEntry> { + @ReceiverDependentMutable + interface InternalEntry> { /** Gets the next entry in the chain. */ E getNext(); @@ -345,7 +353,8 @@ interface InternalEntry> { */ /** Base class for {@link InternalEntry} implementations for strong keys. */ - abstract static class AbstractStrongKeyEntry> + @ReceiverDependentMutable + abstract static class AbstractStrongKeyEntry> implements InternalEntry { final K key; final int hash; @@ -374,11 +383,13 @@ public E getNext() { } /** Marker interface for {@link InternalEntry} implementations for strong values. */ - interface StrongValueEntry> + @ReceiverDependentMutable + interface StrongValueEntry> extends InternalEntry {} /** Marker interface for {@link InternalEntry} implementations for weak values. */ - interface WeakValueEntry> extends InternalEntry { + @ReceiverDependentMutable + interface WeakValueEntry> extends InternalEntry { /** Gets the weak value reference held by entry. */ WeakValueReference getValueReference(); @@ -390,13 +401,14 @@ interface WeakValueEntry> extends Interna } @SuppressWarnings("unchecked") // impl never uses a parameter or returns any non-null value - static > + static > WeakValueReference unsetWeakValueReference() { return (WeakValueReference) UNSET_WEAK_VALUE_REFERENCE; } /** Concrete implementation of {@link InternalEntry} for strong keys and strong values. */ - static final class StrongKeyStrongValueEntry + @ReceiverDependentMutable + static final class StrongKeyStrongValueEntry extends AbstractStrongKeyEntry> implements StrongValueEntry> { private volatile @Nullable V value = null; @@ -422,7 +434,7 @@ StrongKeyStrongValueEntry copy(StrongKeyStrongValueEntry newNext) { } /** Concrete implementation of {@link InternalEntryHelper} for strong keys and strong values. */ - static final class Helper + static final class Helper implements InternalEntryHelper< K, V, StrongKeyStrongValueEntry, StrongKeyStrongValueSegment> { private static final Helper INSTANCE = new Helper<>(); @@ -480,7 +492,8 @@ public StrongKeyStrongValueEntry newEntry( } /** Concrete implementation of {@link InternalEntry} for strong keys and weak values. */ - static final class StrongKeyWeakValueEntry + @ReceiverDependentMutable + static final class StrongKeyWeakValueEntry extends AbstractStrongKeyEntry> implements WeakValueEntry> { private volatile WeakValueReference> valueReference = @@ -519,7 +532,7 @@ public WeakValueReference> getValueReference } /** Concrete implementation of {@link InternalEntryHelper} for strong keys and weak values. */ - static final class Helper + static final class Helper implements InternalEntryHelper< K, V, StrongKeyWeakValueEntry, StrongKeyWeakValueSegment> { private static final Helper INSTANCE = new Helper<>(); @@ -577,7 +590,8 @@ public StrongKeyWeakValueEntry newEntry( } /** Concrete implementation of {@link InternalEntry} for strong keys and {@link Dummy} values. */ - static final class StrongKeyDummyValueEntry + @ReceiverDependentMutable + static final class StrongKeyDummyValueEntry extends AbstractStrongKeyEntry> implements StrongValueEntry> { StrongKeyDummyValueEntry(K key, int hash, @Nullable StrongKeyDummyValueEntry next) { @@ -599,13 +613,13 @@ StrongKeyDummyValueEntry copy(StrongKeyDummyValueEntry newNext) { * Concrete implementation of {@link InternalEntryHelper} for strong keys and {@link Dummy} * values. */ - static final class Helper + static final class Helper implements InternalEntryHelper< K, Dummy, StrongKeyDummyValueEntry, StrongKeyDummyValueSegment> { private static final Helper INSTANCE = new Helper<>(); @SuppressWarnings("unchecked") - static Helper instance() { + static Helper instance() { return (Helper) INSTANCE; } @@ -652,7 +666,8 @@ public StrongKeyDummyValueEntry newEntry( } /** Base class for {@link InternalEntry} implementations for weak keys. */ - abstract static class AbstractWeakKeyEntry> + @ReceiverDependentMutable + abstract static class AbstractWeakKeyEntry> extends WeakReference implements InternalEntry { final int hash; final @Nullable E next; @@ -680,7 +695,8 @@ public E getNext() { } /** Concrete implementation of {@link InternalEntry} for weak keys and {@link Dummy} values. */ - static final class WeakKeyDummyValueEntry + @ReceiverDependentMutable + static final class WeakKeyDummyValueEntry extends AbstractWeakKeyEntry> implements StrongValueEntry> { WeakKeyDummyValueEntry( @@ -704,7 +720,7 @@ WeakKeyDummyValueEntry copy( * Concrete implementation of {@link InternalEntryHelper} for weak keys and {@link Dummy} * values. */ - static final class Helper + static final class Helper implements InternalEntryHelper< K, Dummy, WeakKeyDummyValueEntry, WeakKeyDummyValueSegment> { private static final Helper INSTANCE = new Helper<>(); @@ -760,7 +776,7 @@ public WeakKeyDummyValueEntry newEntry( } /** Concrete implementation of {@link InternalEntry} for weak keys and strong values. */ - static final class WeakKeyStrongValueEntry + static final class WeakKeyStrongValueEntry extends AbstractWeakKeyEntry> implements StrongValueEntry> { private volatile @Nullable V value = null; @@ -788,13 +804,13 @@ WeakKeyStrongValueEntry copy( } /** Concrete implementation of {@link InternalEntryHelper} for weak keys and strong values. */ - static final class Helper + static final class Helper implements InternalEntryHelper< K, V, WeakKeyStrongValueEntry, WeakKeyStrongValueSegment> { private static final Helper INSTANCE = new Helper<>(); @SuppressWarnings("unchecked") - static Helper instance() { + static Helper instance() { return (Helper) INSTANCE; } @@ -847,7 +863,8 @@ public WeakKeyStrongValueEntry newEntry( } /** Concrete implementation of {@link InternalEntry} for weak keys and weak values. */ - static final class WeakKeyWeakValueEntry + @ReceiverDependentMutable + static final class WeakKeyWeakValueEntry extends AbstractWeakKeyEntry> implements WeakValueEntry> { private volatile WeakValueReference> valueReference = @@ -890,13 +907,13 @@ public WeakValueReference> getValueReference() } /** Concrete implementation of {@link InternalEntryHelper} for weak keys and weak values. */ - static final class Helper + static final class Helper implements InternalEntryHelper< K, V, WeakKeyWeakValueEntry, WeakKeyWeakValueSegment> { private static final Helper INSTANCE = new Helper<>(); @SuppressWarnings("unchecked") - static Helper instance() { + static Helper instance() { return (Helper) INSTANCE; } @@ -951,7 +968,8 @@ public WeakKeyWeakValueEntry newEntry( } /** A weakly referenced value that also has a reference to its containing entry. */ - interface WeakValueReference> { + @ReceiverDependentMutable + interface WeakValueReference> { /** * Returns the current value being referenced, or {@code null} if there is none (e.g. because * either it got collected, or {@link #clear} was called, or it wasn't set in the first place). @@ -976,8 +994,9 @@ interface WeakValueReference> { * A dummy implementation of {@link InternalEntry}, solely for use in the type signature of {@link * #UNSET_WEAK_VALUE_REFERENCE} below. */ + @ReceiverDependentMutable static final class DummyInternalEntry - implements InternalEntry { + implements InternalEntry<@Immutable Object, Object, DummyInternalEntry> { private DummyInternalEntry() { throw new AssertionError(); } @@ -1007,8 +1026,8 @@ public Object getValue() { * A singleton {@link WeakValueReference} used to denote an unset value in a entry with weak * values. */ - static final WeakValueReference UNSET_WEAK_VALUE_REFERENCE = - new WeakValueReference() { + static final WeakValueReference<@Immutable Object, Object, DummyInternalEntry> UNSET_WEAK_VALUE_REFERENCE = + new WeakValueReference<@Immutable Object, Object, DummyInternalEntry>() { @Override public DummyInternalEntry getEntry() { return null; @@ -1030,7 +1049,8 @@ public WeakValueReference copyFor( }; /** Concrete implementation of {@link WeakValueReference}. */ - static final class WeakValueReferenceImpl> + @ReceiverDependentMutable + static final class WeakValueReferenceImpl> extends WeakReference implements WeakValueReference { @Weak final E entry; @@ -1143,8 +1163,9 @@ final Segment[] newSegmentArray(int ssize) { * opportunistically, just to simplify some locking and avoid separate construction. */ @SuppressWarnings("serial") // This class is never serialized. + @ReceiverDependentMutable abstract static class Segment< - K, V, E extends InternalEntry, S extends Segment> + K extends @Immutable Object, V, E extends InternalEntry, S extends Segment> extends ReentrantLock { /* @@ -2001,6 +2022,7 @@ void runLockedCleanup() { } /** Concrete implementation of {@link Segment} for strong keys and strong values. */ + @ReceiverDependentMutable static final class StrongKeyStrongValueSegment extends Segment, StrongKeyStrongValueSegment> { StrongKeyStrongValueSegment( @@ -2025,7 +2047,7 @@ public StrongKeyStrongValueEntry castForTesting(InternalEntry ent } /** Concrete implementation of {@link Segment} for strong keys and weak values. */ - static final class StrongKeyWeakValueSegment + static final class StrongKeyWeakValueSegment extends Segment, StrongKeyWeakValueSegment> { private final ReferenceQueue queueForValues = new ReferenceQueue(); @@ -2090,7 +2112,8 @@ void maybeClearReferenceQueues() { } /** Concrete implementation of {@link Segment} for strong keys and {@link Dummy} values. */ - static final class StrongKeyDummyValueSegment + @ReceiverDependentMutable + static final class StrongKeyDummyValueSegment extends Segment, StrongKeyDummyValueSegment> { StrongKeyDummyValueSegment( MapMakerInternalMap, StrongKeyDummyValueSegment> @@ -2113,7 +2136,8 @@ public StrongKeyDummyValueEntry castForTesting(InternalEntry ent } /** Concrete implementation of {@link Segment} for weak keys and strong values. */ - static final class WeakKeyStrongValueSegment + @ReceiverDependentMutable + static final class WeakKeyStrongValueSegment extends Segment, WeakKeyStrongValueSegment> { private final ReferenceQueue queueForKeys = new ReferenceQueue(); @@ -2153,7 +2177,8 @@ void maybeClearReferenceQueues() { } /** Concrete implementation of {@link Segment} for weak keys and weak values. */ - static final class WeakKeyWeakValueSegment + @ReceiverDependentMutable + static final class WeakKeyWeakValueSegment extends Segment, WeakKeyWeakValueSegment> { private final ReferenceQueue queueForKeys = new ReferenceQueue(); private final ReferenceQueue queueForValues = new ReferenceQueue(); @@ -2224,6 +2249,7 @@ void maybeClearReferenceQueues() { } /** Concrete implementation of {@link Segment} for weak keys and {@link Dummy} values. */ + @ReceiverDependentMutable static final class WeakKeyDummyValueSegment extends Segment, WeakKeyDummyValueSegment> { private final ReferenceQueue queueForKeys = new ReferenceQueue(); @@ -2293,7 +2319,7 @@ Strength valueStrength() { } @VisibleForTesting - Equivalence valueEquivalence() { + Equivalence<@Readonly Object> valueEquivalence() { return entryHelper.valueStrength().defaultEquivalence(); } @@ -2506,6 +2532,7 @@ public Collection values() { // Iterator Support + @ReceiverDependentMutable abstract class HashIterator implements Iterator { int nextSegmentIndex; @@ -2614,6 +2641,7 @@ public void remove() { } } + @ReceiverDependentMutable final class KeyIterator extends HashIterator { @Override @@ -2622,6 +2650,7 @@ public K next() { } } + @ReceiverDependentMutable final class ValueIterator extends HashIterator { @Override @@ -2634,6 +2663,7 @@ public V next() { * Custom Entry class used by EntryIterator.next(), that relays setValue changes to the underlying * map. */ + @ReceiverDependentMutable final class WriteThroughEntry extends AbstractMapEntry { final K key; // non-null V value; // non-null @@ -2677,6 +2707,7 @@ public V setValue(V newValue) { } } + @ReceiverDependentMutable final class EntryIterator extends HashIterator> { @Override @@ -2686,6 +2717,7 @@ public Entry next() { } @WeakOuter + @ReceiverDependentMutable final class KeySet extends SafeToArraySet { @Override @@ -2720,6 +2752,7 @@ public void clear() { } @WeakOuter + @ReceiverDependentMutable final class Values extends AbstractCollection { @Override @@ -2763,6 +2796,7 @@ public T[] toArray(T[] a) { } @WeakOuter + @ReceiverDependentMutable final class EntrySet extends SafeToArraySet> { @Override @@ -2811,7 +2845,7 @@ public void clear() { } } - private abstract static class SafeToArraySet extends AbstractSet { + @ReceiverDependentMutable private abstract static class SafeToArraySet extends AbstractSet { // super.toArray() may misbehave if size() is inaccurate, at least on old versions of Android. // https://code.google.com/p/android/issues/detail?id=36519 / http://r.android.com/47508 @@ -2851,7 +2885,8 @@ Object writeReplace() { * The actual object that gets serialized. Unfortunately, readResolve() doesn't get called when a * circular dependency is present, so the proxy must be able to behave as the map itself. */ - abstract static class AbstractSerializationProxy extends ForwardingConcurrentMap + @ReceiverDependentMutable + abstract static class AbstractSerializationProxy extends ForwardingConcurrentMap implements Serializable { private static final long serialVersionUID = 3; diff --git a/guava/src/com/google/common/collect/Maps.java b/guava/src/com/google/common/collect/Maps.java index 84859e95644e..691f673ce0c8 100644 --- a/guava/src/com/google/common/collect/Maps.java +++ b/guava/src/com/google/common/collect/Maps.java @@ -75,6 +75,12 @@ import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; @@ -102,36 +108,36 @@ public final class Maps { private Maps() {} - private enum EntryFunction implements Function, @Nullable Object> { + private enum EntryFunction implements Function, @Nullable @Readonly Object> { KEY { @Override @CheckForNull - public Object apply(Entry entry) { + public @Readonly Object apply(Entry entry) { return entry.getKey(); } }, VALUE { @Override @CheckForNull - public Object apply(Entry entry) { + public @Readonly Object apply(Entry entry) { return entry.getValue(); } }; } @SuppressWarnings("unchecked") - static Function, K> keyFunction() { + static Function, K> keyFunction() { return (Function) EntryFunction.KEY; } @SuppressWarnings("unchecked") - static Function, V> valueFunction() { + static Function, V> valueFunction() { return (Function) EntryFunction.VALUE; } - static Iterator keyIterator( - Iterator> entryIterator) { - return new TransformedIterator, K>(entryIterator) { + static Iterator keyIterator( + Iterator<@PolyMutable Entry> entryIterator) { + return new TransformedIterator<@PolyMutable Entry, K>(entryIterator) { @Override @ParametricNullness K transform(Entry entry) { @@ -140,9 +146,9 @@ K transform(Entry entry) { }; } - static Iterator valueIterator( - Iterator> entryIterator) { - return new TransformedIterator, V>(entryIterator) { + static Iterator valueIterator( + Iterator<@PolyMutable Entry> entryIterator) { + return new TransformedIterator<@PolyMutable Entry, V>(entryIterator) { @Override @ParametricNullness V transform(Entry entry) { @@ -163,14 +169,14 @@ V transform(Entry entry) { * @since 14.0 */ @GwtCompatible(serializable = true) - public static , V> ImmutableMap immutableEnumMap( - Map map) { + public static , V extends @Immutable Object> ImmutableMap immutableEnumMap( + @Readonly Map map) { if (map instanceof ImmutableEnumMap) { @SuppressWarnings("unchecked") // safe covariant cast ImmutableEnumMap result = (ImmutableEnumMap) map; return result; } - Iterator> entryItr = map.entrySet().iterator(); + Iterator> entryItr = map.entrySet().iterator(); if (!entryItr.hasNext()) { return ImmutableMap.of(); } @@ -205,7 +211,7 @@ public static , V> ImmutableMap immutableEnumMap( * * @since 21.0 */ - public static , V> + public static , V> Collector> toImmutableEnumMap( java.util.function.Function keyFunction, java.util.function.Function valueFunction) { @@ -223,7 +229,7 @@ public static , V> ImmutableMap immutableEnumMap( * * @since 21.0 */ - public static , V> + public static , V> Collector> toImmutableEnumMap( java.util.function.Function keyFunction, java.util.function.Function valueFunction, @@ -244,7 +250,7 @@ public static , V> ImmutableMap immutableEnumMap( * * @return a new, empty {@code HashMap} */ - public static + public static HashMap newHashMap() { return new HashMap<>(); } @@ -263,9 +269,9 @@ HashMap newHashMap() { * @param map the mappings to be placed in the new map * @return a new {@code HashMap} initialized with the mappings from {@code map} */ - public static HashMap newHashMap( - Map map) { - return new HashMap<>(map); + public static @PolyMutable HashMap newHashMap( + @PolyMutable Map map) { + return new @PolyMutable HashMap<>(map); } /** @@ -279,8 +285,8 @@ HashMap newHashMap() { * without resizing * @throws IllegalArgumentException if {@code expectedSize} is negative */ - public static - HashMap newHashMapWithExpectedSize(int expectedSize) { + public static + HashMap newHashMapWithExpectedSize(int expectedSize) { return new HashMap<>(capacity(expectedSize)); } @@ -313,7 +319,7 @@ static int capacity(int expectedSize) { * * @return a new, empty {@code LinkedHashMap} */ - public static + public static LinkedHashMap newLinkedHashMap() { return new LinkedHashMap<>(); } @@ -331,9 +337,9 @@ LinkedHashMap newLinkedHashMap() { * @param map the mappings to be placed in the new map * @return a new, {@code LinkedHashMap} initialized with the mappings from {@code map} */ - public static - LinkedHashMap newLinkedHashMap(Map map) { - return new LinkedHashMap<>(map); + public static + @PolyMutable LinkedHashMap newLinkedHashMap(@PolyMutable Map map) { + return new @PolyMutable LinkedHashMap<>(map); } /** @@ -348,7 +354,7 @@ LinkedHashMap newLinkedHashMap(Map map) { * @throws IllegalArgumentException if {@code expectedSize} is negative * @since 19.0 */ - public static + public static LinkedHashMap newLinkedHashMapWithExpectedSize(int expectedSize) { return new LinkedHashMap<>(capacity(expectedSize)); } @@ -358,7 +364,7 @@ LinkedHashMap newLinkedHashMapWithExpectedSize(int expectedSize) { * * @since 3.0 */ - public static ConcurrentMap newConcurrentMap() { + public static ConcurrentMap newConcurrentMap() { return new ConcurrentHashMap<>(); } @@ -374,7 +380,7 @@ public static ConcurrentMap newConcurrentMap() { * * @return a new, empty {@code TreeMap} */ - public static TreeMap newTreeMap() { + public static TreeMap newTreeMap() { return new TreeMap<>(); } @@ -394,9 +400,9 @@ public static ConcurrentMap newConcurrentMap() { * @return a new {@code TreeMap} initialized with the mappings from {@code map} and using the * comparator of {@code map} */ - public static TreeMap newTreeMap( - SortedMap map) { - return new TreeMap<>(map); + public static @PolyMutable TreeMap newTreeMap( + @PolyMutable SortedMap map) { + return new @PolyMutable TreeMap<>(map); } /** @@ -412,7 +418,7 @@ public static ConcurrentMap newConcurrentMap() { * @param comparator the comparator to sort the keys with * @return a new, empty {@code TreeMap} */ - public static + public static TreeMap newTreeMap(@CheckForNull Comparator comparator) { // Ideally, the extra type parameter "C" shouldn't be necessary. It is a // work-around of a compiler type inference quirk that prevents the @@ -428,7 +434,7 @@ TreeMap newTreeMap(@CheckForNull Comparator comparator) { * @param type the key type for this map * @return a new, empty {@code EnumMap} */ - public static , V extends @Nullable Object> EnumMap newEnumMap( + public static , V extends @Nullable @Readonly Object> EnumMap newEnumMap( Class type) { return new EnumMap<>(checkNotNull(type)); } @@ -445,9 +451,9 @@ TreeMap newTreeMap(@CheckForNull Comparator comparator) { * @throws IllegalArgumentException if {@code m} is not an {@code EnumMap} instance and contains * no mappings */ - public static , V extends @Nullable Object> EnumMap newEnumMap( - Map map) { - return new EnumMap<>(map); + public static , V extends @Nullable @Readonly Object> @PolyMutable EnumMap newEnumMap( + @PolyMutable Map map) { + return new @PolyMutable EnumMap<>(map); } /** @@ -459,7 +465,7 @@ TreeMap newTreeMap(@CheckForNull Comparator comparator) { * * @return a new, empty {@code IdentityHashMap} */ - public static + public static IdentityHashMap newIdentityHashMap() { return new IdentityHashMap<>(); } @@ -480,9 +486,9 @@ IdentityHashMap newIdentityHashMap() { * @return the difference between the two maps */ @SuppressWarnings("unchecked") - public static + public static MapDifference difference( - Map left, Map right) { + @Readonly Map left, @Readonly Map right) { if (left instanceof SortedMap) { SortedMap sortedLeft = (SortedMap) left; return difference(sortedLeft, right); @@ -525,7 +531,7 @@ MapDifference difference( * Still, if we decide that we want to make that work, we'd need to introduce a new type parameter * for the Equivalence input type: * - * ... difference(..., Equivalence ...) + * ... difference(..., Equivalence ...) * * Maybe we should, even though it will break source compatibility. * @@ -543,9 +549,9 @@ MapDifference difference( * (Vaguely related: Another thing we could consider is an overload that accepts a BiPredicate: * https://github.com/google/guava/issues/3913) */ - public static MapDifference difference( - Map left, - Map right, + public static MapDifference difference( + @Readonly Map left, + @Readonly Map right, Equivalence valueEquivalence) { Preconditions.checkNotNull(valueEquivalence); @@ -574,12 +580,12 @@ MapDifference difference( * @return the difference between the two maps * @since 11.0 */ - public static + public static SortedMapDifference difference( - SortedMap left, Map right) { + @Readonly SortedMap left, @Readonly Map right) { checkNotNull(left); checkNotNull(right); - Comparator comparator = orNaturalOrder(left.comparator()); + Comparator<@Immutable ? super K> comparator = orNaturalOrder(left.comparator()); SortedMap onlyOnLeft = Maps.newTreeMap(comparator); SortedMap onlyOnRight = Maps.newTreeMap(comparator); onlyOnRight.putAll(right); // will whittle it down @@ -602,11 +608,11 @@ SortedMapDifference difference( return new SortedMapDifferenceImpl<>(onlyOnLeft, onlyOnRight, onBoth, differences); } - private static void doDifference( - Map left, - Map right, + private static void doDifference( + @Readonly Map left, + @Readonly Map right, Equivalence valueEquivalence, - Map onlyOnLeft, + @Readonly Map onlyOnLeft, Map onlyOnRight, Map onBoth, Map> differences) { @@ -636,8 +642,8 @@ SortedMapDifference difference( } } - private static Map unmodifiableMap( - Map map) { + private static @Readonly Map unmodifiableMap( + @Readonly Map map) { if (map instanceof SortedMap) { return Collections.unmodifiableSortedMap((SortedMap) map); } else { @@ -645,18 +651,19 @@ SortedMapDifference difference( } } - static class MapDifferenceImpl + @Immutable + static class MapDifferenceImpl implements MapDifference { - final Map onlyOnLeft; - final Map onlyOnRight; - final Map onBoth; - final Map> differences; + final @Readonly Map onlyOnLeft; + final @Readonly Map onlyOnRight; + final @Readonly Map onBoth; + final @Readonly Map> differences; MapDifferenceImpl( - Map onlyOnLeft, - Map onlyOnRight, - Map onBoth, - Map> differences) { + @Readonly Map onlyOnLeft, + @Readonly Map onlyOnRight, + @Readonly Map onBoth, + @Readonly Map> differences) { this.onlyOnLeft = unmodifiableMap(onlyOnLeft); this.onlyOnRight = unmodifiableMap(onlyOnRight); this.onBoth = unmodifiableMap(onBoth); @@ -669,28 +676,28 @@ public boolean areEqual() { } @Override - public Map entriesOnlyOnLeft() { + public @Readonly Map entriesOnlyOnLeft() { return onlyOnLeft; } @Override - public Map entriesOnlyOnRight() { + public @Readonly Map entriesOnlyOnRight() { return onlyOnRight; } @Override - public Map entriesInCommon() { + public @Readonly Map entriesInCommon() { return onBoth; } @Override - public Map> entriesDiffering() { + public @Readonly Map> entriesDiffering() { return differences; } @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@CheckForNull @Readonly Object object) { if (object == this) { return true; } @@ -706,7 +713,7 @@ && entriesInCommon().equals(other.entriesInCommon()) @Pure @Override - public int hashCode(@UnknownSignedness MapDifferenceImpl this) { + public int hashCode(@UnknownSignedness @Readonly MapDifferenceImpl this) { return Objects.hashCode( entriesOnlyOnLeft(), entriesOnlyOnRight(), entriesInCommon(), entriesDiffering()); } @@ -732,12 +739,13 @@ public String toString() { } } - static class ValueDifferenceImpl + @Immutable + static class ValueDifferenceImpl implements MapDifference.ValueDifference { @ParametricNullness private final V left; @ParametricNullness private final V right; - static ValueDifference create( + static ValueDifference create( @ParametricNullness V left, @ParametricNullness V right) { return new ValueDifferenceImpl(left, right); } @@ -761,7 +769,7 @@ public V rightValue() { @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@CheckForNull @Readonly Object object) { if (object instanceof MapDifference.ValueDifference) { MapDifference.ValueDifference that = (MapDifference.ValueDifference) object; return Objects.equal(this.left, that.leftValue()) @@ -772,7 +780,7 @@ public boolean equals(@CheckForNull Object object) { @Pure @Override - public int hashCode(@UnknownSignedness ValueDifferenceImpl this) { + public int hashCode(@UnknownSignedness @Readonly ValueDifferenceImpl this) { return Objects.hashCode(left, right); } @@ -783,34 +791,35 @@ public String toString() { } } - static class SortedMapDifferenceImpl + @Immutable + static class SortedMapDifferenceImpl extends MapDifferenceImpl implements SortedMapDifference { SortedMapDifferenceImpl( - SortedMap onlyOnLeft, - SortedMap onlyOnRight, - SortedMap onBoth, - SortedMap> differences) { + @Readonly SortedMap onlyOnLeft, + @Readonly SortedMap onlyOnRight, + @Readonly SortedMap onBoth, + @Readonly SortedMap> differences) { super(onlyOnLeft, onlyOnRight, onBoth, differences); } @Override - public SortedMap> entriesDiffering() { - return (SortedMap>) super.entriesDiffering(); + public @Readonly SortedMap> entriesDiffering() { + return (@Readonly SortedMap>) super.entriesDiffering(); } @Override - public SortedMap entriesInCommon() { - return (SortedMap) super.entriesInCommon(); + public @Readonly SortedMap entriesInCommon() { + return (@Readonly SortedMap) super.entriesInCommon(); } @Override - public SortedMap entriesOnlyOnLeft() { - return (SortedMap) super.entriesOnlyOnLeft(); + public @Readonly SortedMap entriesOnlyOnLeft() { + return (@Readonly SortedMap) super.entriesOnlyOnLeft(); } @Override - public SortedMap entriesOnlyOnRight() { - return (SortedMap) super.entriesOnlyOnRight(); + public @Readonly SortedMap entriesOnlyOnRight() { + return (@Readonly SortedMap) super.entriesOnlyOnRight(); } } @@ -820,7 +829,7 @@ public SortedMap entriesOnlyOnRight() { * ugly type-casting in one place. */ @SuppressWarnings("unchecked") - static Comparator orNaturalOrder( + static Comparator orNaturalOrder( @CheckForNull Comparator comparator) { if (comparator != null) { // can't use ? : because of javac bug 5080917 return comparator; @@ -852,9 +861,9 @@ public SortedMap entriesOnlyOnRight() { * * @since 14.0 */ - public static Map asMap( - Set set, Function function) { - return new AsMapView<>(set, function); + public static @PolyMutable Map asMap( + @PolyMutable Set set, Function function) { + return new @PolyMutable AsMapView<>(set, function); } /** @@ -880,9 +889,9 @@ public SortedMap entriesOnlyOnRight() { * * @since 14.0 */ - public static SortedMap asMap( - SortedSet set, Function function) { - return new SortedAsMapView<>(set, function); + public static @PolyMutable SortedMap asMap( + @PolyMutable SortedSet set, Function function) { + return new @PolyMutable SortedAsMapView<>(set, function); } /** @@ -909,33 +918,34 @@ public SortedMap entriesOnlyOnRight() { * @since 14.0 */ @GwtIncompatible // NavigableMap - public static NavigableMap asMap( - NavigableSet set, Function function) { - return new NavigableAsMapView<>(set, function); + public static @PolyMutable NavigableMap asMap( + @PolyMutable NavigableSet set, Function function) { + return new @PolyMutable NavigableAsMapView<>(set, function); } - private static class AsMapView + @ReceiverDependentMutable + private static class AsMapView extends ViewCachingAbstractMap { private final Set set; final Function function; - Set backingSet() { + @PolyMutable Set backingSet(@PolyMutable AsMapView this) { return set; } - AsMapView(Set set, Function function) { + AsMapView(@ReceiverDependentMutable Set set, Function function) { this.set = checkNotNull(set); this.function = checkNotNull(function); } @Override - public Set createKeySet() { + public @PolyMutable Set createKeySet(@PolyMutable AsMapView this) { return removeOnlySet(backingSet()); } @Override - Collection createValues() { + @PolyMutable Collection createValues(@PolyMutable AsMapView this) { return Collections2.transform(set, function); } @@ -945,19 +955,19 @@ Collection createValues() { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return backingSet().contains(key); } @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { return getOrDefault(key, null); } @Override @CheckForNull - public V getOrDefault(@CheckForNull @UnknownSignedness Object key, @CheckForNull V defaultValue) { + public V getOrDefault(@CheckForNull @UnknownSignedness @Readonly Object key, @CheckForNull V defaultValue) { if (Collections2.safeContains(backingSet(), key)) { @SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it K k = (K) key; @@ -969,7 +979,7 @@ public V getOrDefault(@CheckForNull @UnknownSignedness Object key, @CheckForNull @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@CheckForNull @UnknownSignedness @Readonly Object key) { if (backingSet().remove(key)) { @SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it K k = (K) key; @@ -985,7 +995,7 @@ public void clear() { } @Override - protected Set> createEntrySet() { + protected @PolyMutable Set<@PolyMutable Entry> createEntrySet(@PolyMutable AsMapView this) { @WeakOuter class EntrySetImpl extends EntrySet { @Override @@ -1009,9 +1019,9 @@ public void forEach(BiConsumer action) { } } - static - Iterator> asMapEntryIterator(Set set, final Function function) { - return new TransformedIterator>(set.iterator()) { + static + Iterator<@PolyMutable Entry> asMapEntryIterator(@PolyMutable Set set, final Function function) { + return new TransformedIterator>(set.iterator()) { @Override Entry transform(@ParametricNullness final K key) { return immutableEntry(key, function.apply(key)); @@ -1019,60 +1029,62 @@ Entry transform(@ParametricNullness final K key) { }; } - private static class SortedAsMapView + @ReceiverDependentMutable + private static class SortedAsMapView extends AsMapView implements SortedMap { - SortedAsMapView(SortedSet set, Function function) { + SortedAsMapView(@ReceiverDependentMutable SortedSet set, Function function) { super(set, function); } @Override - SortedSet backingSet() { + @PolyMutable SortedSet backingSet(@PolyMutable SortedAsMapView this) { return (SortedSet) super.backingSet(); } @Override @CheckForNull - public Comparator comparator() { + public Comparator comparator(@Readonly SortedAsMapView this) { return backingSet().comparator(); } @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable SortedAsMapView this) { return removeOnlySortedSet(backingSet()); } @Override - public SortedMap subMap(@ParametricNullness K fromKey, @ParametricNullness K toKey) { + public @PolyMutable SortedMap subMap(@PolyMutable SortedAsMapView this, @ParametricNullness K fromKey, @ParametricNullness K toKey) { return asMap(backingSet().subSet(fromKey, toKey), function); } @Override - public SortedMap headMap(@ParametricNullness K toKey) { + public @PolyMutable SortedMap headMap(@PolyMutable SortedAsMapView this, @ParametricNullness K toKey) { return asMap(backingSet().headSet(toKey), function); } @Override - public SortedMap tailMap(@ParametricNullness K fromKey) { + public @PolyMutable SortedMap tailMap(@PolyMutable SortedAsMapView this, @ParametricNullness K fromKey) { return asMap(backingSet().tailSet(fromKey), function); } @Override @ParametricNullness - public @KeyFor("this") K firstKey() { + public @KeyFor("this") K firstKey(@Readonly SortedAsMapView this) { return backingSet().first(); } @Override @ParametricNullness - public @KeyFor("this") K lastKey() { + public @KeyFor("this") K lastKey(@Readonly SortedAsMapView this) { return backingSet().last(); } } @GwtIncompatible // NavigableMap + @ReceiverDependentMutable private static final class NavigableAsMapView< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends AbstractNavigableMap { /* * Using AbstractNavigableMap is simpler than extending SortedAsMapView and rewriting all the @@ -1082,13 +1094,14 @@ private static final class NavigableAsMapView< private final NavigableSet set; private final Function function; - NavigableAsMapView(NavigableSet ks, Function vFunction) { + NavigableAsMapView(@ReceiverDependentMutable NavigableSet ks, Function vFunction) { this.set = checkNotNull(ks); this.function = checkNotNull(vFunction); } @Override - public NavigableMap subMap( + public @PolyMutable NavigableMap subMap( + @PolyMutable NavigableAsMapView this, @ParametricNullness K fromKey, boolean fromInclusive, @ParametricNullness K toKey, @@ -1097,30 +1110,30 @@ public NavigableMap subMap( } @Override - public NavigableMap headMap(@ParametricNullness K toKey, boolean inclusive) { + public @PolyMutable NavigableMap headMap(@PolyMutable NavigableAsMapView this, @ParametricNullness K toKey, boolean inclusive) { return asMap(set.headSet(toKey, inclusive), function); } @Override - public NavigableMap tailMap(@ParametricNullness K fromKey, boolean inclusive) { + public @PolyMutable NavigableMap tailMap(@PolyMutable NavigableAsMapView this, @ParametricNullness K fromKey, boolean inclusive) { return asMap(set.tailSet(fromKey, inclusive), function); } @Override @CheckForNull - public Comparator comparator() { + public Comparator comparator(@Readonly NavigableAsMapView this) { return set.comparator(); } @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@Readonly NavigableAsMapView this, @CheckForNull @UnknownSignedness @Readonly Object key) { return getOrDefault(key, null); } @Override @CheckForNull - public V getOrDefault(@CheckForNull @UnknownSignedness Object key, @CheckForNull V defaultValue) { + public V getOrDefault(@Readonly NavigableAsMapView this, @CheckForNull @UnknownSignedness @Readonly Object key, @CheckForNull V defaultValue) { if (Collections2.safeContains(set, key)) { @SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it K k = (K) key; @@ -1131,17 +1144,17 @@ public V getOrDefault(@CheckForNull @UnknownSignedness Object key, @CheckForNull } @Override - public void clear() { + public void clear(@Mutable NavigableAsMapView this) { set.clear(); } @Override - Iterator> entryIterator() { + Iterator<@PolyMutable Entry> entryIterator(@PolyMutable NavigableAsMapView this) { return asMapEntryIterator(set, function); } @Override - Spliterator> entrySpliterator() { + Spliterator<@PolyMutable Entry> entrySpliterator(@PolyMutable NavigableAsMapView this) { return CollectSpliterators.map(set.spliterator(), e -> immutableEntry(e, function.apply(e))); } @@ -1151,27 +1164,27 @@ public void forEach(BiConsumer action) { } @Override - Iterator> descendingEntryIterator() { + Iterator<@PolyMutable Entry> descendingEntryIterator(@PolyMutable NavigableAsMapView this) { return descendingMap().entrySet().iterator(); } @Override - public NavigableSet<@KeyFor({"this"}) K> navigableKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> navigableKeySet(@PolyMutable NavigableAsMapView this) { return removeOnlyNavigableSet(set); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly NavigableAsMapView this) { return set.size(); } @Override - public NavigableMap descendingMap() { + public @PolyMutable NavigableMap descendingMap(@PolyMutable NavigableAsMapView this) { return asMap(set.descendingSet(), function); } } - private static Set removeOnlySet(final Set set) { + private static Set removeOnlySet(final Set set) { return new ForwardingSet() { @Override protected Set delegate() { @@ -1190,7 +1203,7 @@ public boolean addAll(Collection es) { }; } - private static SortedSet removeOnlySortedSet( + private static SortedSet removeOnlySortedSet( final SortedSet set) { return new ForwardingSortedSet() { @Override @@ -1227,7 +1240,7 @@ public SortedSet tailSet(@ParametricNullness E fromElement) { } @GwtIncompatible // NavigableSet - private static NavigableSet removeOnlyNavigableSet( + private static NavigableSet removeOnlyNavigableSet( final NavigableSet set) { return new ForwardingNavigableSet() { @Override @@ -1304,7 +1317,7 @@ public NavigableSet descendingSet() { * valueFunction} produces {@code null} for any key * @since 14.0 */ - public static ImmutableMap toMap( + public static ImmutableMap toMap( Iterable keys, Function valueFunction) { return toMap(keys.iterator(), valueFunction); } @@ -1322,7 +1335,7 @@ public static ImmutableMap toMap( * valueFunction} produces {@code null} for any key * @since 14.0 */ - public static ImmutableMap toMap( + public static ImmutableMap toMap( Iterator keys, Function valueFunction) { checkNotNull(valueFunction); ImmutableMap.Builder builder = ImmutableMap.builder(); @@ -1363,7 +1376,7 @@ public static ImmutableMap toMap( * keyFunction} produces {@code null} for any value */ @CanIgnoreReturnValue - public static ImmutableMap uniqueIndex( + public static ImmutableMap uniqueIndex( Iterable values, Function keyFunction) { // TODO(lowasser): consider presizing the builder if values is a Collection return uniqueIndex(values.iterator(), keyFunction); @@ -1399,7 +1412,7 @@ public static ImmutableMap uniqueIndex( * @since 10.0 */ @CanIgnoreReturnValue - public static ImmutableMap uniqueIndex( + public static ImmutableMap uniqueIndex( Iterator values, Function keyFunction) { checkNotNull(keyFunction); ImmutableMap.Builder builder = ImmutableMap.builder(); @@ -1477,7 +1490,7 @@ public static ImmutableMap fromProperties(Properties properties) * @param value the value to be associated with the returned entry */ @GwtCompatible(serializable = true) - public static Entry immutableEntry( + public static @Immutable Entry immutableEntry( @ParametricNullness K key, @ParametricNullness V value) { return new ImmutableEntry<>(key, value); } @@ -1490,8 +1503,8 @@ public static ImmutableMap fromProperties(Properties properties) * @param entrySet the entries for which to return an unmodifiable view * @return an unmodifiable view of the entries */ - static - Set> unmodifiableEntrySet(Set> entrySet) { + static + @Readonly Set<@Readonly Entry> unmodifiableEntrySet(@Readonly Set<@PolyMutable Entry> entrySet) { return new UnmodifiableEntrySet<>(Collections.unmodifiableSet(entrySet)); } @@ -1504,8 +1517,8 @@ Set> unmodifiableEntrySet(Set> entrySet) { * @param entry the entry for which to return an unmodifiable view * @return an unmodifiable view of the entry */ - static Entry unmodifiableEntry( - final Entry entry) { + static @Readonly Entry unmodifiableEntry( + final @Readonly Entry entry) { checkNotNull(entry); return new AbstractMapEntry() { @Override @@ -1522,9 +1535,9 @@ public V getValue() { }; } - static - UnmodifiableIterator> unmodifiableEntryIterator( - final Iterator> entryIterator) { + static + @Readonly UnmodifiableIterator> unmodifiableEntryIterator( + final @Readonly Iterator> entryIterator) { return new UnmodifiableIterator>() { @Override public boolean hasNext() { @@ -1539,21 +1552,22 @@ public Entry next() { } /** @see Multimaps#unmodifiableEntries */ - static class UnmodifiableEntries - extends ForwardingCollection> { - private final Collection> entries; + @Immutable + static class UnmodifiableEntries + extends ForwardingCollection<@Readonly Entry> { + private final @Readonly Collection<@Readonly Entry> entries; - UnmodifiableEntries(Collection> entries) { + UnmodifiableEntries(@Readonly Collection<@Readonly Entry> entries) { this.entries = entries; } @Override - protected Collection> delegate() { + protected @Readonly Collection<@Readonly Entry> delegate() { return entries; } @Override - public Iterator> iterator() { + public Iterator<@Readonly Entry> iterator() { return unmodifiableEntryIterator(entries.iterator()); } @@ -1575,23 +1589,24 @@ public Iterator> iterator() { @Override @SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations - public T[] toArray(@PolyNull T[] array) { + public T[] toArray(@PolyNull T[] array) { return standardToArray(array); } @Pure @Override - public boolean contains(@Nullable @UnknownSignedness Object arg0) { return super.contains(arg0); } + public boolean contains(@Nullable @UnknownSignedness @Readonly Object arg0) { return super.contains(arg0); } @Pure @Override - public boolean containsAll(Collection arg0) { return super.containsAll(arg0); } + public boolean containsAll(@Readonly Collection arg0) { return super.containsAll(arg0); } } /** @see Maps#unmodifiableEntrySet(Set) */ - static class UnmodifiableEntrySet - extends UnmodifiableEntries implements Set> { - UnmodifiableEntrySet(Set> entries) { + @Immutable + static class UnmodifiableEntrySet + extends UnmodifiableEntries implements Set<@Readonly Entry> { + UnmodifiableEntrySet(@Readonly Set<@Readonly Entry> entries) { super(entries); } @@ -1599,13 +1614,13 @@ static class UnmodifiableEntrySet this) { + public int hashCode(@UnknownSignedness @Readonly UnmodifiableEntrySet this) { return Sets.hashCodeImpl(this); } } @@ -1620,14 +1635,15 @@ public int hashCode(@UnknownSignedness UnmodifiableEntrySet this) { * * @since 16.0 */ - public static Converter asConverter(final BiMap bimap) { + public static Converter asConverter(final BiMap bimap) { return new BiMapConverter<>(bimap); } - private static final class BiMapConverter extends Converter implements Serializable { + @ReceiverDependentMutable + private static final class BiMapConverter extends Converter implements Serializable { private final BiMap bimap; - BiMapConverter(BiMap bimap) { + BiMapConverter(@ReceiverDependentMutable BiMap bimap) { this.bimap = checkNotNull(bimap); } @@ -1642,14 +1658,14 @@ protected A doBackward(B b) { } @SuppressWarnings("signedness:argument") // diagnostic output - private static Y convert(BiMap bimap, X input) { + private static Y convert(@Readonly BiMap bimap, X input) { Y output = bimap.get(input); checkArgument(output != null, "No non-null mapping present for input: %s", input); return output; } @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@Readonly BiMapConverter this, @CheckForNull @Readonly Object object) { if (object instanceof BiMapConverter) { BiMapConverter that = (BiMapConverter) object; return this.bimap.equals(that.bimap); @@ -1658,13 +1674,13 @@ public boolean equals(@CheckForNull Object object) { } @Override - public int hashCode(@UnknownSignedness BiMapConverter this) { + public int hashCode(@UnknownSignedness @Readonly BiMapConverter this) { return bimap.hashCode(); } // There's really no good way to implement toString() without printing the entire BiMap, right? @Override - public String toString() { + public String toString(@Readonly BiMapConverter this) { return "Maps.asConverter(" + bimap + ")"; } @@ -1700,7 +1716,7 @@ public String toString() { * @param bimap the bimap to be wrapped in a synchronized view * @return a synchronized view of the specified bimap */ - public static + public static BiMap synchronizedBiMap(BiMap bimap) { return Synchronized.biMap(bimap, null); } @@ -1716,27 +1732,28 @@ BiMap synchronizedBiMap(BiMap bimap) { * @param bimap the bimap for which an unmodifiable view is to be returned * @return an unmodifiable view of the specified bimap */ - public static + public static BiMap unmodifiableBiMap(BiMap bimap) { return new UnmodifiableBiMap<>(bimap, null); } /** @see Maps#unmodifiableBiMap(BiMap) */ - private static class UnmodifiableBiMap + @Immutable + private static class UnmodifiableBiMap extends ForwardingMap implements BiMap, Serializable { - final Map unmodifiableMap; - final BiMap delegate; - @RetainedWith @CheckForNull BiMap inverse; - @CheckForNull transient Set values; + final @Readonly Map unmodifiableMap; + final @Readonly BiMap delegate; + @RetainedWith @CheckForNull @Readonly BiMap inverse; + @CheckForNull transient @Readonly Set values; - UnmodifiableBiMap(BiMap delegate, @CheckForNull BiMap inverse) { + UnmodifiableBiMap(@Readonly BiMap delegate, @CheckForNull @Readonly BiMap inverse) { unmodifiableMap = Collections.unmodifiableMap(delegate); this.delegate = delegate; this.inverse = inverse; } @Override - protected Map delegate() { + protected @Readonly Map delegate() { return unmodifiableMap; } @@ -1758,7 +1775,7 @@ public V putIfAbsent(K key, V value) { } @Override - public boolean remove(@Nullable @UnknownSignedness Object key, @Nullable @UnknownSignedness Object value) { + public boolean remove(@Nullable @UnknownSignedness @Readonly Object key, @Nullable @UnknownSignedness @Readonly Object value) { throw new UnsupportedOperationException(); } @@ -1798,7 +1815,7 @@ public V replace(K key, V value) { } @Override - public BiMap inverse() { + public @Readonly BiMap inverse() { BiMap result = inverse; return (result == null) ? inverse = new UnmodifiableBiMap<>(delegate.inverse(), this) @@ -1807,7 +1824,7 @@ public BiMap inverse() { @SideEffectFree @Override - public Set values() { + public @Readonly Set values() { Set result = values; return (result == null) ? values = Collections.unmodifiableSet(delegate.values()) : result; } @@ -1849,8 +1866,8 @@ public Set values() { * view, copy the returned map into a new map of your choosing. */ public static < - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> - Map transformValues(Map fromMap, Function function) { + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> + @PolyMutable Map transformValues(@PolyMutable Map fromMap, Function function) { return transformEntries(fromMap, asEntryTransformer(function)); } @@ -1891,7 +1908,7 @@ Map transformValues(Map fromMap, Function function * @since 11.0 */ public static < - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> SortedMap transformValues( SortedMap fromMap, Function function) { return transformEntries(fromMap, asEntryTransformer(function)); @@ -1937,7 +1954,7 @@ SortedMap transformValues( */ @GwtIncompatible // NavigableMap public static < - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> NavigableMap transformValues( NavigableMap fromMap, Function function) { return transformEntries(fromMap, asEntryTransformer(function)); @@ -1991,10 +2008,10 @@ NavigableMap transformValues( * @since 7.0 */ public static < - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> - Map transformEntries( - Map fromMap, EntryTransformer transformer) { - return new TransformedEntriesMap<>(fromMap, transformer); + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> + @PolyMutable Map transformEntries( + @PolyMutable Map fromMap, EntryTransformer transformer) { + return new @PolyMutable TransformedEntriesMap<>(fromMap, transformer); } /** @@ -2045,7 +2062,7 @@ Map transformEntries( * @since 11.0 */ public static < - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> SortedMap transformEntries( SortedMap fromMap, EntryTransformer transformer) { return new TransformedEntriesSortedMap<>(fromMap, transformer); @@ -2101,7 +2118,7 @@ SortedMap transformEntries( */ @GwtIncompatible // NavigableMap public static < - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> NavigableMap transformEntries( NavigableMap fromMap, EntryTransformer transformer) { return new TransformedEntriesNavigableMap<>(fromMap, transformer); @@ -2117,8 +2134,9 @@ NavigableMap transformEntries( * @since 7.0 */ @FunctionalInterface + @ReceiverDependentMutable public interface EntryTransformer< - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> { + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> { /** * Determines an output value based on a key-value pair. This method is generally * expected, but not absolutely required, to have the following properties: @@ -2137,7 +2155,7 @@ public interface EntryTransformer< } /** Views a function as an entry transformer that ignores the entry key. */ - static + static EntryTransformer asEntryTransformer(final Function function) { checkNotNull(function); return new EntryTransformer() { @@ -2149,7 +2167,7 @@ public V2 transformEntry(@ParametricNullness K key, @ParametricNullness V1 value }; } - static + static Function asValueToValueFunction( final EntryTransformer transformer, @ParametricNullness final K key) { checkNotNull(transformer); @@ -2163,7 +2181,7 @@ public V2 apply(@ParametricNullness V1 v1) { } /** Views an entry transformer as a function from {@code Entry} to values. */ - static + static Function, V2> asEntryToValueFunction( final EntryTransformer transformer) { checkNotNull(transformer); @@ -2177,7 +2195,7 @@ public V2 apply(Entry entry) { } /** Returns a view of an entry transformed by the specified transformer. */ - static + static Entry transformEntry( final EntryTransformer transformer, final Entry entry) { checkNotNull(transformer); @@ -2198,7 +2216,7 @@ public V2 getValue() { } /** Views an entry transformer as a function from entries to entries. */ - static + static Function, Entry> asEntryToEntryFunction( final EntryTransformer transformer) { checkNotNull(transformer); @@ -2210,31 +2228,32 @@ public Entry apply(final Entry entry) { }; } + @ReceiverDependentMutable static class TransformedEntriesMap< - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> extends IteratorBasedAbstractMap { final Map fromMap; final EntryTransformer transformer; TransformedEntriesMap( - Map fromMap, EntryTransformer transformer) { + @ReceiverDependentMutable Map fromMap, EntryTransformer transformer) { this.fromMap = checkNotNull(fromMap); this.transformer = checkNotNull(transformer); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly TransformedEntriesMap this) { return fromMap.size(); } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly TransformedEntriesMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return fromMap.containsKey(key); } @Override @CheckForNull - public V2 get(@CheckForNull @UnknownSignedness Object key) { + public V2 get(@Readonly TransformedEntriesMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return getOrDefault(key, null); } @@ -2242,7 +2261,7 @@ public V2 get(@CheckForNull @UnknownSignedness Object key) { @SuppressWarnings("unchecked") @Override @CheckForNull - public V2 getOrDefault(@CheckForNull @UnknownSignedness Object key, @CheckForNull V2 defaultValue) { + public V2 getOrDefault(@Readonly TransformedEntriesMap this, @CheckForNull @UnknownSignedness @Readonly Object key, @CheckForNull V2 defaultValue) { V1 value = fromMap.get(key); if (value != null || fromMap.containsKey(key)) { // The cast is safe because of the containsKey check. @@ -2255,7 +2274,7 @@ public V2 getOrDefault(@CheckForNull @UnknownSignedness Object key, @CheckForNul @SuppressWarnings("unchecked") @Override @CheckForNull - public V2 remove(@CheckForNull @UnknownSignedness Object key) { + public V2 remove(@Mutable TransformedEntriesMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return fromMap.containsKey(key) // The cast is safe because of the containsKey check. ? transformer.transformEntry((K) key, uncheckedCastNullableTToT(fromMap.remove(key))) @@ -2263,23 +2282,23 @@ public V2 remove(@CheckForNull @UnknownSignedness Object key) { } @Override - public void clear() { + public void clear(@Mutable TransformedEntriesMap this) { fromMap.clear(); } @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable TransformedEntriesMap this) { return fromMap.keySet(); } @Override - Iterator> entryIterator() { + Iterator<@PolyMutable Entry> entryIterator(@PolyMutable TransformedEntriesMap this) { return Iterators.transform( fromMap.entrySet().iterator(), Maps.asEntryToEntryFunction(transformer)); } @Override - Spliterator> entrySpliterator() { + Spliterator<@PolyMutable Entry> entrySpliterator(@PolyMutable TransformedEntriesMap this) { return CollectSpliterators.map( fromMap.entrySet().spliterator(), Maps.asEntryToEntryFunction(transformer)); } @@ -2292,167 +2311,170 @@ public void forEach(BiConsumer action) { } @Override - public Collection values() { - return new Values<>(this); + public @PolyMutable Collection values(@PolyMutable TransformedEntriesMap this) { + return new @PolyMutable Values<>(this); } } + @ReceiverDependentMutable static class TransformedEntriesSortedMap< - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> extends TransformedEntriesMap implements SortedMap { - protected SortedMap fromMap() { - return (SortedMap) fromMap; + protected @PolyMutable SortedMap fromMap(@PolyMutable TransformedEntriesSortedMap this) { + return (@PolyMutable SortedMap) fromMap; } TransformedEntriesSortedMap( - SortedMap fromMap, EntryTransformer transformer) { + @ReceiverDependentMutable SortedMap fromMap, EntryTransformer transformer) { super(fromMap, transformer); } @Override @CheckForNull - public Comparator comparator() { + public Comparator comparator(@Readonly TransformedEntriesSortedMap this) { return fromMap().comparator(); } @Override @ParametricNullness - public @KeyFor("this") K firstKey() { + public @KeyFor("this") K firstKey(@Readonly TransformedEntriesSortedMap this) { return fromMap().firstKey(); } @Override - public SortedMap headMap(@ParametricNullness K toKey) { + public @PolyMutable SortedMap headMap(@PolyMutable TransformedEntriesSortedMap this, @ParametricNullness K toKey) { return transformEntries(fromMap().headMap(toKey), transformer); } @Override @ParametricNullness - public @KeyFor("this") K lastKey() { + public @KeyFor("this") K lastKey(@Readonly TransformedEntriesSortedMap this) { return fromMap().lastKey(); } @Override - public SortedMap subMap(@ParametricNullness K fromKey, @ParametricNullness K toKey) { + public @PolyMutable SortedMap subMap(@PolyMutable TransformedEntriesSortedMap this, @ParametricNullness K fromKey, @ParametricNullness K toKey) { return transformEntries(fromMap().subMap(fromKey, toKey), transformer); } @Override - public SortedMap tailMap(@ParametricNullness K fromKey) { + public @PolyMutable SortedMap tailMap(@PolyMutable TransformedEntriesSortedMap this, @ParametricNullness K fromKey) { return transformEntries(fromMap().tailMap(fromKey), transformer); } } @GwtIncompatible // NavigableMap + @ReceiverDependentMutable private static class TransformedEntriesNavigableMap< - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> extends TransformedEntriesSortedMap implements NavigableMap { TransformedEntriesNavigableMap( - NavigableMap fromMap, EntryTransformer transformer) { + @ReceiverDependentMutable NavigableMap fromMap, EntryTransformer transformer) { super(fromMap, transformer); } @Override @CheckForNull - public Entry ceilingEntry(@ParametricNullness K key) { + public @PolyMutable Entry ceilingEntry(@PolyMutable TransformedEntriesNavigableMap this, @ParametricNullness K key) { return transformEntry(fromMap().ceilingEntry(key)); } @Override @CheckForNull - public K ceilingKey(@ParametricNullness K key) { + public K ceilingKey(@Readonly TransformedEntriesNavigableMap this, @ParametricNullness K key) { return fromMap().ceilingKey(key); } @Override - public NavigableSet<@KeyFor({"this"}) K> descendingKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> descendingKeySet(@PolyMutable TransformedEntriesNavigableMap this) { return fromMap().descendingKeySet(); } @Override - public NavigableMap descendingMap() { + public @PolyMutable NavigableMap descendingMap(@PolyMutable TransformedEntriesNavigableMap this) { return transformEntries(fromMap().descendingMap(), transformer); } @Override @CheckForNull - public Entry firstEntry() { + public @PolyMutable Entry firstEntry(@PolyMutable TransformedEntriesNavigableMap this) { return transformEntry(fromMap().firstEntry()); } @Override @CheckForNull - public Entry floorEntry(@ParametricNullness K key) { + public @PolyMutable Entry floorEntry(@PolyMutable TransformedEntriesNavigableMap this, @ParametricNullness K key) { return transformEntry(fromMap().floorEntry(key)); } @Override @CheckForNull - public K floorKey(@ParametricNullness K key) { + public K floorKey(@Readonly TransformedEntriesNavigableMap this, @ParametricNullness K key) { return fromMap().floorKey(key); } @Override - public NavigableMap headMap(@ParametricNullness K toKey) { + public @PolyMutable NavigableMap headMap(@PolyMutable TransformedEntriesNavigableMap this, @ParametricNullness K toKey) { return headMap(toKey, false); } @Override - public NavigableMap headMap(@ParametricNullness K toKey, boolean inclusive) { + public @PolyMutable NavigableMap headMap(@PolyMutable TransformedEntriesNavigableMap this, @ParametricNullness K toKey, boolean inclusive) { return transformEntries(fromMap().headMap(toKey, inclusive), transformer); } @Override @CheckForNull - public Entry higherEntry(@ParametricNullness K key) { + public @PolyMutable Entry higherEntry(@PolyMutable TransformedEntriesNavigableMap this, @ParametricNullness K key) { return transformEntry(fromMap().higherEntry(key)); } @Override @CheckForNull - public K higherKey(@ParametricNullness K key) { + public K higherKey(@Readonly TransformedEntriesNavigableMap this, @ParametricNullness K key) { return fromMap().higherKey(key); } @Override @CheckForNull - public Entry lastEntry() { + public @PolyMutable Entry lastEntry(@PolyMutable TransformedEntriesNavigableMap this) { return transformEntry(fromMap().lastEntry()); } @Override @CheckForNull - public Entry lowerEntry(@ParametricNullness K key) { + public @PolyMutable Entry lowerEntry(@PolyMutable TransformedEntriesNavigableMap this, @ParametricNullness K key) { return transformEntry(fromMap().lowerEntry(key)); } @Override @CheckForNull - public K lowerKey(@ParametricNullness K key) { + public K lowerKey(@Readonly TransformedEntriesNavigableMap this, @ParametricNullness K key) { return fromMap().lowerKey(key); } @Override - public NavigableSet<@KeyFor({"this"}) K> navigableKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> navigableKeySet(@PolyMutable TransformedEntriesNavigableMap this) { return fromMap().navigableKeySet(); } @Override @CheckForNull - public Entry pollFirstEntry() { + public Entry pollFirstEntry(@Mutable TransformedEntriesNavigableMap this) { return transformEntry(fromMap().pollFirstEntry()); } @Override @CheckForNull - public Entry pollLastEntry() { + public Entry pollLastEntry(@Mutable TransformedEntriesNavigableMap this) { return transformEntry(fromMap().pollLastEntry()); } @Override - public NavigableMap subMap( + public @PolyMutable NavigableMap subMap( + @PolyMutable TransformedEntriesNavigableMap this, @ParametricNullness K fromKey, boolean fromInclusive, @ParametricNullness K toKey, @@ -2462,37 +2484,37 @@ public NavigableMap subMap( } @Override - public NavigableMap subMap(@ParametricNullness K fromKey, @ParametricNullness K toKey) { + public @PolyMutable NavigableMap subMap(@PolyMutable TransformedEntriesNavigableMap this, @ParametricNullness K fromKey, @ParametricNullness K toKey) { return subMap(fromKey, true, toKey, false); } @Override - public NavigableMap tailMap(@ParametricNullness K fromKey) { + public @PolyMutable NavigableMap tailMap(@PolyMutable TransformedEntriesNavigableMap this, @ParametricNullness K fromKey) { return tailMap(fromKey, true); } @Override - public NavigableMap tailMap(@ParametricNullness K fromKey, boolean inclusive) { + public @PolyMutable NavigableMap tailMap(@PolyMutable TransformedEntriesNavigableMap this, @ParametricNullness K fromKey, boolean inclusive) { return transformEntries(fromMap().tailMap(fromKey, inclusive), transformer); } @CheckForNull - private Entry transformEntry(@CheckForNull Entry entry) { + private @PolyMutable Entry transformEntry(@PolyMutable TransformedEntriesNavigableMap this, @CheckForNull Entry entry) { return (entry == null) ? null : Maps.transformEntry(transformer, entry); } @Override - protected NavigableMap fromMap() { + protected @PolyMutable NavigableMap fromMap(@PolyMutable TransformedEntriesNavigableMap this) { return (NavigableMap) super.fromMap(); } } - static Predicate> keyPredicateOnEntries( + static Predicate> keyPredicateOnEntries( Predicate keyPredicate) { return compose(keyPredicate, Maps.keyFunction()); } - static Predicate> valuePredicateOnEntries( + static Predicate> valuePredicateOnEntries( Predicate valuePredicate) { return compose(valuePredicate, Maps.valueFunction()); } @@ -2520,7 +2542,7 @@ protected NavigableMap fromMap() { * {@link Predicate#apply}. Do not provide a predicate such as {@code * Predicates.instanceOf(ArrayList.class)}, which is inconsistent with equals. */ - public static Map filterKeys( + public static Map filterKeys( Map unfiltered, final Predicate keyPredicate) { checkNotNull(keyPredicate); Predicate> entryPredicate = keyPredicateOnEntries(keyPredicate); @@ -2555,7 +2577,7 @@ protected NavigableMap fromMap() { * * @since 11.0 */ - public static SortedMap filterKeys( + public static SortedMap filterKeys( SortedMap unfiltered, final Predicate keyPredicate) { // TODO(lowasser): Return a subclass of Maps.FilteredKeyMap for slightly better // performance. @@ -2589,7 +2611,7 @@ protected NavigableMap fromMap() { * @since 14.0 */ @GwtIncompatible // NavigableMap - public static + public static NavigableMap filterKeys( NavigableMap unfiltered, final Predicate keyPredicate) { // TODO(lowasser): Return a subclass of Maps.FilteredKeyMap for slightly better @@ -2621,7 +2643,7 @@ NavigableMap filterKeys( * * @since 14.0 */ - public static BiMap filterKeys( + public static BiMap filterKeys( BiMap unfiltered, final Predicate keyPredicate) { checkNotNull(keyPredicate); return filterEntries(unfiltered, Maps.keyPredicateOnEntries(keyPredicate)); @@ -2650,7 +2672,7 @@ NavigableMap filterKeys( * at {@link Predicate#apply}. Do not provide a predicate such as {@code * Predicates.instanceOf(ArrayList.class)}, which is inconsistent with equals. */ - public static Map filterValues( + public static Map filterValues( Map unfiltered, final Predicate valuePredicate) { return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate)); } @@ -2681,7 +2703,7 @@ NavigableMap filterKeys( * * @since 11.0 */ - public static + public static SortedMap filterValues( SortedMap unfiltered, final Predicate valuePredicate) { return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate)); @@ -2714,7 +2736,7 @@ SortedMap filterValues( * @since 14.0 */ @GwtIncompatible // NavigableMap - public static + public static NavigableMap filterValues( NavigableMap unfiltered, final Predicate valuePredicate) { return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate)); @@ -2747,7 +2769,7 @@ NavigableMap filterValues( * * @since 14.0 */ - public static BiMap filterValues( + public static BiMap filterValues( BiMap unfiltered, final Predicate valuePredicate) { return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate)); } @@ -2776,7 +2798,7 @@ NavigableMap filterValues( *

Warning: {@code entryPredicate} must be consistent with equals, as documented * at {@link Predicate#apply}. */ - public static Map filterEntries( + public static Map filterEntries( Map unfiltered, Predicate> entryPredicate) { checkNotNull(entryPredicate); return (unfiltered instanceof AbstractFilteredMap) @@ -2810,7 +2832,7 @@ NavigableMap filterValues( * * @since 11.0 */ - public static + public static SortedMap filterEntries( SortedMap unfiltered, Predicate> entryPredicate) { checkNotNull(entryPredicate); @@ -2846,7 +2868,7 @@ SortedMap filterEntries( * @since 14.0 */ @GwtIncompatible // NavigableMap - public static + public static NavigableMap filterEntries( NavigableMap unfiltered, Predicate> entryPredicate) { checkNotNull(entryPredicate); @@ -2882,7 +2904,7 @@ NavigableMap filterEntries( * * @since 14.0 */ - public static BiMap filterEntries( + public static BiMap filterEntries( BiMap unfiltered, Predicate> entryPredicate) { checkNotNull(unfiltered); checkNotNull(entryPredicate); @@ -2895,7 +2917,7 @@ NavigableMap filterEntries( * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when filtering a filtered * map. */ - private static Map filterFiltered( + private static Map filterFiltered( AbstractFilteredMap map, Predicate> entryPredicate) { return new FilteredEntryMap<>( map.unfiltered, Predicates.>and(map.predicate, entryPredicate)); @@ -2905,7 +2927,7 @@ NavigableMap filterEntries( * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when filtering a filtered * sorted map. */ - private static + private static SortedMap filterFiltered( FilteredEntrySortedMap map, Predicate> entryPredicate) { Predicate> predicate = Predicates.>and(map.predicate, entryPredicate); @@ -2917,7 +2939,7 @@ SortedMap filterFiltered( * navigable map. */ @GwtIncompatible // NavigableMap - private static + private static NavigableMap filterFiltered( FilteredEntryNavigableMap map, Predicate> entryPredicate) { Predicate> predicate = @@ -2929,25 +2951,26 @@ NavigableMap filterFiltered( * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when filtering a filtered * map. */ - private static + private static BiMap filterFiltered( FilteredEntryBiMap map, Predicate> entryPredicate) { Predicate> predicate = Predicates.>and(map.predicate, entryPredicate); return new FilteredEntryBiMap<>(map.unfiltered(), predicate); } + @ReceiverDependentMutable private abstract static class AbstractFilteredMap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends ViewCachingAbstractMap { final Map unfiltered; final Predicate> predicate; - AbstractFilteredMap(Map unfiltered, Predicate> predicate) { + AbstractFilteredMap(@ReceiverDependentMutable Map unfiltered, Predicate> predicate) { this.unfiltered = unfiltered; this.predicate = predicate; } - boolean apply(@CheckForNull Object key, @ParametricNullness V value) { + boolean apply(@CheckForNull @Readonly Object key, @ParametricNullness V value) { // This method is called only when the key is in the map (or about to be added to the map), // implying that key is a K. @SuppressWarnings({"unchecked", "nullness"}) @@ -2957,13 +2980,13 @@ boolean apply(@CheckForNull Object key, @ParametricNullness V value) { @Override @CheckForNull - public V put(@ParametricNullness K key, @ParametricNullness V value) { + public V put(@Mutable AbstractFilteredMap this, @ParametricNullness K key, @ParametricNullness V value) { checkArgument(apply(key, value)); return unfiltered.put(key, value); } @Override - public void putAll(Map map) { + public void putAll(@Mutable AbstractFilteredMap this, @Readonly Map map) { for (Entry entry : map.entrySet()) { checkArgument(apply(entry.getKey(), entry.getValue())); } @@ -2972,108 +2995,110 @@ public void putAll(Map map) { @Pure @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly AbstractFilteredMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return unfiltered.containsKey(key) && apply(key, unfiltered.get(key)); } @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@Readonly AbstractFilteredMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { V value = unfiltered.get(key); return ((value != null) && apply(key, value)) ? value : null; } @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly AbstractFilteredMapthis) { return entrySet().isEmpty(); } @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@Mutable AbstractFilteredMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return containsKey(key) ? unfiltered.remove(key) : null; } @Override - Collection createValues() { - return new FilteredMapValues<>(this, unfiltered, predicate); + @PolyMutable Collection createValues(@PolyMutable AbstractFilteredMap this) { + return new @PolyMutable FilteredMapValues<>(this, unfiltered, predicate); } } + @ReceiverDependentMutable private static final class FilteredMapValues< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends Maps.Values { - final Map unfiltered; - final Predicate> predicate; - - FilteredMapValues( - Map filteredMap, Map unfiltered, Predicate> predicate) { - super(filteredMap); - this.unfiltered = unfiltered; - this.predicate = predicate; - } + final Map unfiltered; + final Predicate> predicate; + + FilteredMapValues( + @ReceiverDependentMutable Map filteredMap, Map unfiltered, Predicate> predicate) { + super(filteredMap); + this.unfiltered = unfiltered; + this.predicate = predicate; + } - @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { - Iterator> entryItr = unfiltered.entrySet().iterator(); - while (entryItr.hasNext()) { - Entry entry = entryItr.next(); - if (predicate.apply(entry) && Objects.equal(entry.getValue(), o)) { - entryItr.remove(); - return true; - } + @Override + public boolean remove(@Mutable FilteredMapValuesthis, @Readonly @CheckForNull @UnknownSignedness Object o) { + Iterator> entryItr = unfiltered.entrySet().iterator(); + while (entryItr.hasNext()) { + Entry entry = entryItr.next(); + if (predicate.apply(entry) && Objects.equal(entry.getValue(), o)) { + entryItr.remove(); + return true; + } + } + return false; } - return false; - } - @Override - public boolean removeAll(Collection collection) { - Iterator> entryItr = unfiltered.entrySet().iterator(); - boolean result = false; - while (entryItr.hasNext()) { - Entry entry = entryItr.next(); - if (predicate.apply(entry) && collection.contains(entry.getValue())) { - entryItr.remove(); - result = true; - } + @Override + public boolean removeAll(@Mutable FilteredMapValuesthis, @Readonly Collection collection) { + Iterator> entryItr = unfiltered.entrySet().iterator(); + boolean result = false; + while (entryItr.hasNext()) { + Entry entry = entryItr.next(); + if (predicate.apply(entry) && collection.contains(entry.getValue())) { + entryItr.remove(); + result = true; + } + } + return result; } - return result; - } - @Override - public boolean retainAll(Collection collection) { - Iterator> entryItr = unfiltered.entrySet().iterator(); - boolean result = false; - while (entryItr.hasNext()) { - Entry entry = entryItr.next(); - if (predicate.apply(entry) && !collection.contains(entry.getValue())) { - entryItr.remove(); - result = true; - } + @Override + public boolean retainAll(@Mutable FilteredMapValuesthis, @Readonly Collection collection) { + Iterator> entryItr = unfiltered.entrySet().iterator(); + boolean result = false; + while (entryItr.hasNext()) { + Entry entry = entryItr.next(); + if (predicate.apply(entry) && !collection.contains(entry.getValue())) { + entryItr.remove(); + result = true; + } + } + return result; } - return result; - } - @Override - public @PolyNull @PolySigned Object[] toArray(FilteredMapValues<@PolyNull @PolySigned K, V> this) { - // creating an ArrayList so filtering happens once - return Lists.newArrayList(iterator()).toArray(); - } + @Override + public @PolyNull @PolySigned @PolyMutable Object[] toArray(FilteredMapValues<@PolyNull @PolySigned @PolyMutable K, V>this) { + // creating an ArrayList so filtering happens once + return Lists.newArrayList(iterator()).toArray(); + } - @Override - @SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations - public T[] toArray(T[] array) { - return Lists.newArrayList(iterator()).toArray(array); - } + @Override + @SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations + public T[] toArray(T[] array) { + return Lists.newArrayList(iterator()).toArray(array); + } } - private static class FilteredKeyMap + @ReceiverDependentMutable + private static class FilteredKeyMap extends AbstractFilteredMap { final Predicate keyPredicate; FilteredKeyMap( - Map unfiltered, + @ReceiverDependentMutable Map unfiltered, Predicate keyPredicate, Predicate> entryPredicate) { super(unfiltered, entryPredicate); @@ -3081,12 +3106,12 @@ private static class FilteredKeyMap> createEntrySet() { + protected @PolyMutable Set<@PolyMutable Entry> createEntrySet(@PolyMutable FilteredKeyMap this) { return Sets.filter(unfiltered.entrySet(), predicate); } @Override - Set createKeySet() { + @PolyMutable Set createKeySet(@PolyMutable FilteredKeyMap this) { return Sets.filter(unfiltered.keySet(), keyPredicate); } @@ -3095,38 +3120,41 @@ Set createKeySet() { @Pure @Override @SuppressWarnings("unchecked") - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly FilteredKeyMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return unfiltered.containsKey(key) && keyPredicate.apply((K) key); } } - static class FilteredEntryMap + @ReceiverDependentMutable + static class FilteredEntryMap extends AbstractFilteredMap { /** * Entries in this set satisfy the predicate, but they don't validate the input to {@code * Entry.setValue()}. */ - final Set> filteredEntrySet; + final Set<@ReceiverDependentMutable Entry> filteredEntrySet; - FilteredEntryMap(Map unfiltered, Predicate> entryPredicate) { + FilteredEntryMap(@ReceiverDependentMutable Map unfiltered, Predicate> entryPredicate) { super(unfiltered, entryPredicate); filteredEntrySet = Sets.filter(unfiltered.entrySet(), predicate); } @Override - protected Set> createEntrySet() { + protected @PolyMutable Set<@PolyMutable Entry> createEntrySet(@PolyMutable FilteredEntryMap this) { return new EntrySet(); } @WeakOuter - private class EntrySet extends ForwardingSet> { + @ReceiverDependentMutable + @CFComment("PICO: outer receiver dependency") + private class EntrySet extends ForwardingSet<@Readonly Entry> { @Override - protected Set> delegate() { + protected Set<@Readonly Entry> delegate() { return filteredEntrySet; } @Override - public Iterator> iterator() { + public Iterator<@Readonly Entry> iterator() { return new TransformedIterator, Entry>(filteredEntrySet.iterator()) { @Override Entry transform(final Entry entry) { @@ -3153,8 +3181,8 @@ Set createKeySet() { return new KeySet(); } - static boolean removeAllKeys( - Map map, Predicate> entryPredicate, Collection keyCollection) { + static boolean removeAllKeys( + @Mutable Map map, Predicate> entryPredicate, @Readonly Collection keyCollection) { Iterator> entryItr = map.entrySet().iterator(); boolean result = false; while (entryItr.hasNext()) { @@ -3167,8 +3195,8 @@ Set createKeySet() { return result; } - static boolean retainAllKeys( - Map map, Predicate> entryPredicate, Collection keyCollection) { + static boolean retainAllKeys( + @Mutable Map map, Predicate> entryPredicate, @Readonly Collection keyCollection) { Iterator> entryItr = map.entrySet().iterator(); boolean result = false; while (entryItr.hasNext()) { @@ -3182,13 +3210,14 @@ Set createKeySet() { } @WeakOuter + @ReceiverDependentMutable class KeySet extends Maps.KeySet { KeySet() { super(FilteredEntryMap.this); } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable KeySet this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (containsKey(o)) { unfiltered.remove(o); return true; @@ -3197,12 +3226,12 @@ public boolean remove(@CheckForNull @UnknownSignedness Object o) { } @Override - public boolean removeAll(Collection collection) { + public boolean removeAll(@Mutable KeySet this, @Readonly Collection collection) { return removeAllKeys(unfiltered, predicate, collection); } @Override - public boolean retainAll(Collection collection) { + public boolean retainAll(@Mutable KeySet this, @Readonly Collection collection) { return retainAllKeys(unfiltered, predicate, collection); } @@ -3220,34 +3249,36 @@ public boolean retainAll(Collection collection) { @Pure @Override - public boolean contains(@Nullable @UnknownSignedness Object arg0) { return super.contains(arg0); } + public boolean contains(@Nullable @UnknownSignedness @Readonly Object arg0) { return super.contains(arg0); } } } + @ReceiverDependentMutable private static class FilteredEntrySortedMap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends FilteredEntryMap implements SortedMap { FilteredEntrySortedMap( - SortedMap unfiltered, Predicate> entryPredicate) { + @ReceiverDependentMutable SortedMap unfiltered, Predicate> entryPredicate) { super(unfiltered, entryPredicate); } - SortedMap sortedMap() { - return (SortedMap) unfiltered; + @PolyMutable SortedMap sortedMap(@PolyMutable FilteredEntrySortedMap this) { + return (@PolyMutable SortedMap) unfiltered; } @Override - public SortedSet<@KeyFor({"this"}) K> keySet() { - return (SortedSet) super.keySet(); + public @PolyMutable SortedSet<@KeyFor({"this"}) K> keySet(@PolyMutable FilteredEntrySortedMap this) { + return (@PolyMutable SortedSet) super.keySet(); } @Override - SortedSet createKeySet() { + @PolyMutable SortedSet createKeySet(@PolyMutable FilteredEntrySortedMap this) { return new SortedKeySet(); } @WeakOuter + @ReceiverDependentMutable class SortedKeySet extends KeySet implements SortedSet { @Override @CheckForNull @@ -3256,30 +3287,31 @@ public Comparator comparator() { } @Override - public SortedSet subSet( + public @PolyMutable SortedSet subSet( + @PolyMutable SortedKeySet this, @ParametricNullness K fromElement, @ParametricNullness K toElement) { - return (SortedSet) subMap(fromElement, toElement).keySet(); + return (@PolyMutable SortedSet) subMap(fromElement, toElement).keySet(); } @Override - public SortedSet headSet(@ParametricNullness K toElement) { - return (SortedSet) headMap(toElement).keySet(); + public @PolyMutable SortedSet headSet(@PolyMutable SortedKeySet this, @ParametricNullness K toElement) { + return (@PolyMutable SortedSet) headMap(toElement).keySet(); } @Override - public SortedSet tailSet(@ParametricNullness K fromElement) { - return (SortedSet) tailMap(fromElement).keySet(); + public @PolyMutable SortedSet tailSet(@PolyMutable SortedKeySet this, @ParametricNullness K fromElement) { + return (@PolyMutable SortedSet) tailMap(fromElement).keySet(); } @Override @ParametricNullness - public K first() { + public K first(@Readonly SortedKeySet this) { return firstKey(); } @Override @ParametricNullness - public K last() { + public K last(@Readonly SortedKeySet this) { return lastKey(); } } @@ -3292,14 +3324,14 @@ public Comparator comparator() { @Override @ParametricNullness - public @KeyFor("this") K firstKey() { + public @KeyFor("this") K firstKey(@Readonly FilteredEntrySortedMap this) { // correctly throws NoSuchElementException when filtered map is empty. return keySet().iterator().next(); } @Override @ParametricNullness - public @KeyFor("this") K lastKey() { + public @KeyFor("this") K lastKey(@Readonly FilteredEntrySortedMap this) { SortedMap headMap = sortedMap(); while (true) { // correctly throws NoSuchElementException when filtered map is empty. @@ -3313,24 +3345,25 @@ public Comparator comparator() { } @Override - public SortedMap headMap(@ParametricNullness K toKey) { - return new FilteredEntrySortedMap<>(sortedMap().headMap(toKey), predicate); + public @PolyMutable SortedMap headMap(@PolyMutable FilteredEntrySortedMap this, @ParametricNullness K toKey) { + return new @PolyMutable FilteredEntrySortedMap<>(sortedMap().headMap(toKey), predicate); } @Override - public SortedMap subMap(@ParametricNullness K fromKey, @ParametricNullness K toKey) { - return new FilteredEntrySortedMap<>(sortedMap().subMap(fromKey, toKey), predicate); + public @PolyMutable SortedMap subMap(@PolyMutable FilteredEntrySortedMap this, @ParametricNullness K fromKey, @ParametricNullness K toKey) { + return new @PolyMutable FilteredEntrySortedMap<>(sortedMap().subMap(fromKey, toKey), predicate); } @Override - public SortedMap tailMap(@ParametricNullness K fromKey) { - return new FilteredEntrySortedMap<>(sortedMap().tailMap(fromKey), predicate); + public @PolyMutable SortedMap tailMap(@PolyMutable FilteredEntrySortedMap this, @ParametricNullness K fromKey) { + return new @PolyMutable FilteredEntrySortedMap<>(sortedMap().tailMap(fromKey), predicate); } } @GwtIncompatible // NavigableMap + @ReceiverDependentMutable private static class FilteredEntryNavigableMap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends AbstractNavigableMap { /* * It's less code to extend AbstractNavigableMap and forward the filtering logic to @@ -3339,11 +3372,11 @@ private static class FilteredEntryNavigableMap< */ private final NavigableMap unfiltered; - private final Predicate> entryPredicate; + private final Predicate> entryPredicate; private final Map filteredDelegate; FilteredEntryNavigableMap( - NavigableMap unfiltered, Predicate> entryPredicate) { + @ReceiverDependentMutable NavigableMap unfiltered, Predicate> entryPredicate) { this.unfiltered = checkNotNull(unfiltered); this.entryPredicate = entryPredicate; this.filteredDelegate = new FilteredEntryMap<>(unfiltered, entryPredicate); @@ -3356,102 +3389,103 @@ public Comparator comparator() { } @Override - public NavigableSet<@KeyFor({"this"}) K> navigableKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> navigableKeySet(@PolyMutable FilteredEntryNavigableMap this) { return new Maps.NavigableKeySet(this) { @Override - public boolean removeAll(Collection collection) { + public boolean removeAll(@Readonly Collection collection) { return FilteredEntryMap.removeAllKeys(unfiltered, entryPredicate, collection); } @Override - public boolean retainAll(Collection collection) { + public boolean retainAll(@Readonly Collection collection) { return FilteredEntryMap.retainAllKeys(unfiltered, entryPredicate, collection); } }; } @Override - public Collection values() { - return new FilteredMapValues<>(this, unfiltered, entryPredicate); + public @PolyMutable Collection values(@PolyMutable FilteredEntryNavigableMap this) { + return new @PolyMutable FilteredMapValues<>(this, unfiltered, entryPredicate); } @Override - Iterator> entryIterator() { + @Readonly Iterator<@PolyMutable Entry> entryIterator(@PolyMutable FilteredEntryNavigableMap this) { return Iterators.filter(unfiltered.entrySet().iterator(), entryPredicate); } @Override - Iterator> descendingEntryIterator() { + @Readonly Iterator<@PolyMutable Entry> descendingEntryIterator(@PolyMutable FilteredEntryNavigableMap this) { return Iterators.filter(unfiltered.descendingMap().entrySet().iterator(), entryPredicate); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly FilteredEntryNavigableMap this) { return filteredDelegate.size(); } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly FilteredEntryNavigableMap this) { return !Iterables.any(unfiltered.entrySet(), entryPredicate); } @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@Readonly FilteredEntryNavigableMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return filteredDelegate.get(key); } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly FilteredEntryNavigableMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return filteredDelegate.containsKey(key); } @Override @CheckForNull - public V put(@ParametricNullness K key, @ParametricNullness V value) { + public V put(@Mutable FilteredEntryNavigableMap this, @ParametricNullness K key, @ParametricNullness V value) { return filteredDelegate.put(key, value); } @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@Mutable FilteredEntryNavigableMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return filteredDelegate.remove(key); } @Override - public void putAll(Map m) { + public void putAll(@Mutable FilteredEntryNavigableMap this, @Readonly Map m) { filteredDelegate.putAll(m); } @Override - public void clear() { + public void clear(@Mutable FilteredEntryNavigableMap this) { filteredDelegate.clear(); } @Override - public Set> entrySet() { + public @PolyMutable Set<@PolyMutable Entry<@KeyFor({"this"}) K, V>> entrySet(@PolyMutable FilteredEntryNavigableMap this) { return filteredDelegate.entrySet(); } @Override @CheckForNull - public Entry pollFirstEntry() { + public Entry pollFirstEntry(@Mutable FilteredEntryNavigableMap this) { return Iterables.removeFirstMatching(unfiltered.entrySet(), entryPredicate); } @Override @CheckForNull - public Entry pollLastEntry() { + public Entry pollLastEntry(@Mutable FilteredEntryNavigableMap this) { return Iterables.removeFirstMatching(unfiltered.descendingMap().entrySet(), entryPredicate); } @Override - public NavigableMap descendingMap() { + public @PolyMutable NavigableMap descendingMap(@PolyMutable FilteredEntryNavigableMap this) { return filterEntries(unfiltered.descendingMap(), entryPredicate); } @Override - public NavigableMap subMap( + public @PolyMutable NavigableMap subMap( + @PolyMutable FilteredEntryNavigableMap this, @ParametricNullness K fromKey, boolean fromInclusive, @ParametricNullness K toKey, @@ -3461,21 +3495,22 @@ public NavigableMap subMap( } @Override - public NavigableMap headMap(@ParametricNullness K toKey, boolean inclusive) { + public @PolyMutable NavigableMap headMap(@PolyMutable FilteredEntryNavigableMap this, @ParametricNullness K toKey, boolean inclusive) { return filterEntries(unfiltered.headMap(toKey, inclusive), entryPredicate); } @Override - public NavigableMap tailMap(@ParametricNullness K fromKey, boolean inclusive) { + public @PolyMutable NavigableMap tailMap(@PolyMutable FilteredEntryNavigableMap this, @ParametricNullness K fromKey, boolean inclusive) { return filterEntries(unfiltered.tailMap(fromKey, inclusive), entryPredicate); } } - static final class FilteredEntryBiMap + @ReceiverDependentMutable + static final class FilteredEntryBiMap extends FilteredEntryMap implements BiMap { @RetainedWith private final BiMap inverse; - private static + private static Predicate> inversePredicate( final Predicate> forwardPredicate) { return new Predicate>() { @@ -3486,31 +3521,31 @@ public boolean apply(Entry input) { }; } - FilteredEntryBiMap(BiMap delegate, Predicate> predicate) { + FilteredEntryBiMap(@ReceiverDependentMutable BiMap delegate, Predicate> predicate) { super(delegate, predicate); this.inverse = - new FilteredEntryBiMap<>(delegate.inverse(), inversePredicate(predicate), this); + new @ReceiverDependentMutable FilteredEntryBiMap<>(delegate.inverse(), inversePredicate(predicate), this); } private FilteredEntryBiMap( - BiMap delegate, Predicate> predicate, BiMap inverse) { + @ReceiverDependentMutable BiMap delegate, Predicate> predicate, @ReceiverDependentMutable BiMap inverse) { super(delegate, predicate); this.inverse = inverse; } - BiMap unfiltered() { - return (BiMap) unfiltered; + @PolyMutable BiMap unfiltered(@PolyMutable FilteredEntryBiMap this) { + return (@PolyMutable BiMap) unfiltered; } @Override @CheckForNull - public V forcePut(@ParametricNullness K key, @ParametricNullness V value) { + public V forcePut(@Mutable FilteredEntryBiMap this, @ParametricNullness K key, @ParametricNullness V value) { checkArgument(apply(key, value)); return unfiltered().forcePut(key, value); } @Override - public void replaceAll(BiFunction function) { + public void replaceAll(@Mutable FilteredEntryBiMap this, BiFunction function) { unfiltered() .replaceAll( (key, value) -> @@ -3520,12 +3555,12 @@ public void replaceAll(BiFunction function) { } @Override - public BiMap inverse() { + public @PolyMutable BiMap inverse(@PolyMutable FilteredEntryBiMap this) { return inverse; } @Override - public Set values() { + public @PolyMutable Set values(@PolyMutable FilteredEntryBiMap this) { return inverse.keySet(); } } @@ -3549,7 +3584,7 @@ public Set values() { * @since 12.0 */ @GwtIncompatible // NavigableMap - public static + public static NavigableMap unmodifiableNavigableMap(NavigableMap map) { checkNotNull(map); if (map instanceof UnmodifiableNavigableMap) { @@ -3562,34 +3597,35 @@ NavigableMap unmodifiableNavigableMap(NavigableMap map) { } @CheckForNull - private static + private static Entry unmodifiableOrNull(@CheckForNull Entry entry) { return (entry == null) ? null : Maps.unmodifiableEntry(entry); } @GwtIncompatible // NavigableMap - static class UnmodifiableNavigableMap + @Immutable + static class UnmodifiableNavigableMap extends ForwardingSortedMap implements NavigableMap, Serializable { - private final NavigableMap delegate; + private final @Readonly NavigableMap delegate; - UnmodifiableNavigableMap(NavigableMap delegate) { + UnmodifiableNavigableMap(@Readonly NavigableMap delegate) { this.delegate = delegate; } UnmodifiableNavigableMap( - NavigableMap delegate, UnmodifiableNavigableMap descendingMap) { + @Readonly NavigableMap delegate, @Readonly UnmodifiableNavigableMap descendingMap) { this.delegate = delegate; this.descendingMap = descendingMap; } @Override - protected SortedMap delegate() { + protected @Readonly SortedMap delegate() { return Collections.unmodifiableSortedMap(delegate); } @Override @CheckForNull - public Entry lowerEntry(@ParametricNullness K key) { + public @Readonly Entry lowerEntry(@ParametricNullness K key) { return unmodifiableOrNull(delegate.lowerEntry(key)); } @@ -3601,7 +3637,7 @@ public K lowerKey(@ParametricNullness K key) { @Override @CheckForNull - public Entry floorEntry(@ParametricNullness K key) { + public @Readonly Entry floorEntry(@ParametricNullness K key) { return unmodifiableOrNull(delegate.floorEntry(key)); } @@ -3613,7 +3649,7 @@ public K floorKey(@ParametricNullness K key) { @Override @CheckForNull - public Entry ceilingEntry(@ParametricNullness K key) { + public @Readonly Entry ceilingEntry(@ParametricNullness K key) { return unmodifiableOrNull(delegate.ceilingEntry(key)); } @@ -3625,7 +3661,7 @@ public K ceilingKey(@ParametricNullness K key) { @Override @CheckForNull - public Entry higherEntry(@ParametricNullness K key) { + public @Readonly Entry higherEntry(@ParametricNullness K key) { return unmodifiableOrNull(delegate.higherEntry(key)); } @@ -3637,25 +3673,25 @@ public K higherKey(@ParametricNullness K key) { @Override @CheckForNull - public Entry firstEntry() { + public @Readonly Entry firstEntry() { return unmodifiableOrNull(delegate.firstEntry()); } @Override @CheckForNull - public Entry lastEntry() { + public @Readonly Entry lastEntry() { return unmodifiableOrNull(delegate.lastEntry()); } @Override @CheckForNull - public final Entry pollFirstEntry() { + public final @Readonly Entry pollFirstEntry() { throw new UnsupportedOperationException(); } @Override @CheckForNull - public final Entry pollLastEntry() { + public final @Readonly Entry pollLastEntry() { throw new UnsupportedOperationException(); } @@ -3671,7 +3707,7 @@ public V putIfAbsent(K key, V value) { } @Override - public boolean remove(@Nullable @UnknownSignedness Object key, @Nullable @UnknownSignedness Object value) { + public boolean remove(@Nullable @UnknownSignedness @Readonly Object key, @Nullable @UnknownSignedness @Readonly Object value) { throw new UnsupportedOperationException(); } @@ -3713,7 +3749,7 @@ public V replace(K key, V value) { @CheckForNull private transient UnmodifiableNavigableMap descendingMap; @Override - public NavigableMap descendingMap() { + public @Readonly NavigableMap descendingMap() { UnmodifiableNavigableMap result = descendingMap; return (result == null) ? descendingMap = new UnmodifiableNavigableMap<>(delegate.descendingMap(), this) @@ -3721,27 +3757,27 @@ public NavigableMap descendingMap() { } @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @Readonly Set<@KeyFor({"this"}) K> keySet() { return navigableKeySet(); } @Override - public NavigableSet<@KeyFor({"this"}) K> navigableKeySet() { + public @Readonly NavigableSet<@KeyFor({"this"}) K> navigableKeySet() { return Sets.unmodifiableNavigableSet(delegate.navigableKeySet()); } @Override - public NavigableSet<@KeyFor({"this"}) K> descendingKeySet() { + public @Readonly NavigableSet<@KeyFor({"this"}) K> descendingKeySet() { return Sets.unmodifiableNavigableSet(delegate.descendingKeySet()); } @Override - public SortedMap subMap(@ParametricNullness K fromKey, @ParametricNullness K toKey) { + public @Readonly SortedMap subMap(@ParametricNullness K fromKey, @ParametricNullness K toKey) { return subMap(fromKey, true, toKey, false); } @Override - public NavigableMap subMap( + public @Readonly NavigableMap subMap( @ParametricNullness K fromKey, boolean fromInclusive, @ParametricNullness K toKey, @@ -3751,22 +3787,22 @@ public NavigableMap subMap( } @Override - public SortedMap headMap(@ParametricNullness K toKey) { + public @Readonly SortedMap headMap(@ParametricNullness K toKey) { return headMap(toKey, false); } @Override - public NavigableMap headMap(@ParametricNullness K toKey, boolean inclusive) { + public @Readonly NavigableMap headMap(@ParametricNullness K toKey, boolean inclusive) { return Maps.unmodifiableNavigableMap(delegate.headMap(toKey, inclusive)); } @Override - public SortedMap tailMap(@ParametricNullness K fromKey) { + public @Readonly SortedMap tailMap(@ParametricNullness K fromKey) { return tailMap(fromKey, true); } @Override - public NavigableMap tailMap(@ParametricNullness K fromKey, boolean inclusive) { + public @Readonly NavigableMap tailMap(@ParametricNullness K fromKey, boolean inclusive) { return Maps.unmodifiableNavigableMap(delegate.tailMap(fromKey, inclusive)); } } @@ -3821,7 +3857,7 @@ public NavigableMap tailMap(@ParametricNullness K fromKey, boolean inclusi * @since 13.0 */ @GwtIncompatible // NavigableMap - public static + public static NavigableMap synchronizedNavigableMap(NavigableMap navigableMap) { return Synchronized.navigableMap(navigableMap); } @@ -3831,64 +3867,68 @@ NavigableMap synchronizedNavigableMap(NavigableMap navigableMap) { * entrySet views. */ @GwtCompatible + @ReceiverDependentMutable abstract static class ViewCachingAbstractMap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends AbstractMap { /** * Creates the entry set to be returned by {@link #entrySet()}. This method is invoked at most * once on a given map, at the time when {@code entrySet} is first called. */ - abstract Set> createEntrySet(); + abstract @PolyMutable Set<@PolyMutable Entry> createEntrySet(@PolyMutable ViewCachingAbstractMap this); - @CheckForNull private transient Set> entrySet; + @CheckForNull private transient Set<@ReceiverDependentMutable Entry> entrySet; @Override - public Set> entrySet() { + public @PolyMutable Set<@PolyMutable Entry<@KeyFor({"this"}) K, V>> entrySet(@PolyMutable ViewCachingAbstractMap this) { Set> result = entrySet; return (result == null) ? entrySet = createEntrySet() : result; } - @CheckForNull private transient Set keySet; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable Set keySet; @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable ViewCachingAbstractMap this) { Set result = keySet; return (result == null) ? keySet = createKeySet() : result; } - Set createKeySet() { + @PolyMutable Set createKeySet(@PolyMutable ViewCachingAbstractMap this) { return new KeySet<>(this); } - @CheckForNull private transient Collection values; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable Collection values; @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable ViewCachingAbstractMap this) { Collection result = values; return (result == null) ? values = createValues() : result; } - Collection createValues() { - return new Values<>(this); + @PolyMutable Collection createValues(@PolyMutable ViewCachingAbstractMap this) { + return new @PolyMutable Values<>(this); } } + @ReceiverDependentMutable abstract static class IteratorBasedAbstractMap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends AbstractMap { @Override public abstract @NonNegative int size(); - abstract Iterator> entryIterator(); + abstract Iterator<@PolyMutable Entry> entryIterator(@PolyMutable IteratorBasedAbstractMap this); - Spliterator> entrySpliterator() { + Spliterator<@PolyMutable Entry> entrySpliterator(@PolyMutable IteratorBasedAbstractMap this) { return Spliterators.spliterator( entryIterator(), size(), Spliterator.SIZED | Spliterator.DISTINCT); } @Override - public Set> entrySet() { - return new EntrySet() { + public Set<@PolyMutable Entry<@KeyFor({"this"}) K, V>> entrySet(@PolyMutable IteratorBasedAbstractMap this) { + return new @PolyMutable EntrySet() { @Override Map map() { return IteratorBasedAbstractMap.this; @@ -3916,7 +3956,7 @@ void forEachEntry(Consumer> action) { } @Override - public void clear() { + public void clear(@Mutable IteratorBasedAbstractMap this) { Iterators.clear(entryIterator()); } } @@ -3926,7 +3966,7 @@ public void clear() { * NullPointerException}. */ @CheckForNull - static V safeGet(Map map, @CheckForNull @UnknownSignedness Object key) { + static V safeGet(@Readonly Map map, @CheckForNull @UnknownSignedness @Readonly Object key) { checkNotNull(map); try { return map.get(key); @@ -3939,7 +3979,7 @@ public void clear() { * Delegates to {@link Map#containsKey}. Returns {@code false} on {@code ClassCastException} and * {@code NullPointerException}. */ - static boolean safeContainsKey(Map map, @CheckForNull Object key) { + static boolean safeContainsKey(@Readonly Map map, @CheckForNull @Readonly Object key) { checkNotNull(map); try { return map.containsKey(key); @@ -3953,7 +3993,7 @@ static boolean safeContainsKey(Map map, @CheckForNull Object key) { * NullPointerException}. */ @CheckForNull - static V safeRemove(Map map, @CheckForNull Object key) { + static V safeRemove(@Mutable Map map, @CheckForNull @Readonly Object key) { checkNotNull(map); try { return map.remove(key); @@ -3963,12 +4003,12 @@ static boolean safeContainsKey(Map map, @CheckForNull Object key) { } /** An admittedly inefficient implementation of {@link Map#containsKey}. */ - static boolean containsKeyImpl(Map map, @CheckForNull @UnknownSignedness Object key) { + static boolean containsKeyImpl(@Readonly Map map, @CheckForNull @UnknownSignedness @Readonly Object key) { return Iterators.contains(keyIterator(map.entrySet().iterator()), key); } /** An implementation of {@link Map#containsValue}. */ - static boolean containsValueImpl(Map map, @CheckForNull @UnknownSignedness Object value) { + static boolean containsValueImpl(@Readonly Map map, @CheckForNull @UnknownSignedness @Readonly Object value) { return Iterators.contains(valueIterator(map.entrySet().iterator()), value); } @@ -3985,12 +4025,12 @@ static boolean containsValueImpl(Map map, @CheckForNull @UnknownSignedness * @return {@code true} if {@code c} contains {@code o} */ @Pure - static boolean containsEntryImpl( - Collection> c, @CheckForNull Object o) { + static boolean containsEntryImpl( + @Readonly Collection<@PolyMutable Entry> c, @CheckForNull @Readonly Object o) { if (!(o instanceof Entry)) { return false; } - return c.contains(unmodifiableEntry((Entry) o)); + return c.contains(unmodifiableEntry((@PolyMutable Entry) o)); } /** @@ -4004,16 +4044,15 @@ static boolean containsValueImpl(Map map, @CheckForNull @UnknownSignedness * @param o the object to remove from {@code c} * @return {@code true} if {@code c} was changed */ - static boolean removeEntryImpl( - Collection> c, @CheckForNull Object o) { + static boolean removeEntryImpl(Collection<@PolyMutable Entry> c, @CheckForNull @Readonly Object o) { if (!(o instanceof Entry)) { return false; } - return c.remove(unmodifiableEntry((Entry) o)); + return c.remove(unmodifiableEntry((@PolyMutable Entry) o)); } /** An implementation of {@link Map#equals}. */ - static boolean equalsImpl(Map map, @CheckForNull @UnknownSignedness Object object) { + static boolean equalsImpl(@Readonly Map map, @CheckForNull @UnknownSignedness @Readonly Object object) { if (map == object) { return true; } else if (object instanceof Map) { @@ -4024,7 +4063,7 @@ static boolean equalsImpl(Map map, @CheckForNull @UnknownSignedness Object } /** An implementation of {@link Map#toString}. */ - static String toStringImpl(Map map) { + static String toStringImpl(@Readonly Map map) { StringBuilder sb = Collections2.newStringBuilderForCollection(map.size()).append('{'); boolean first = true; for (Entry entry : map.entrySet()) { @@ -4038,54 +4077,55 @@ static String toStringImpl(Map map) { } /** An implementation of {@link Map#putAll}. */ - static void putAllImpl( - Map self, Map map) { + static void putAllImpl( + @Mutable Map self, Map map) { for (Entry entry : map.entrySet()) { self.put(entry.getKey(), entry.getValue()); } } - static class KeySet + @ReceiverDependentMutable + static class KeySet extends Sets.ImprovedAbstractSet { @Weak final Map map; - KeySet(Map map) { + KeySet(@ReceiverDependentMutable Map map) { this.map = checkNotNull(map); } - Map map() { + @PolyMutable Map map(@PolyMutable KeySet this) { return map; } @Override - public Iterator iterator() { + public Iterator iterator(@PolyMutable KeySet this) { return keyIterator(map().entrySet().iterator()); } @Override - public void forEach(Consumer action) { + public void forEach(@Readonly KeySet this, Consumer action) { checkNotNull(action); // avoids entry allocation for those maps that allocate entries on iteration map.forEach((k, v) -> action.accept(k)); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly KeySet this) { return map().size(); } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly KeySet this) { return map().isEmpty(); } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly KeySet this, @CheckForNull @UnknownSignedness @Readonly Object o) { return map().containsKey(o); } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable KeySet this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (contains(o)) { map().remove(o); return true; @@ -4094,30 +4134,31 @@ public boolean remove(@CheckForNull @UnknownSignedness Object o) { } @Override - public void clear() { + public void clear(@Mutable KeySet this) { map().clear(); } } @CheckForNull - static K keyOrNull(@CheckForNull Entry entry) { + static K keyOrNull(@CheckForNull @Readonly Entry entry) { return (entry == null) ? null : entry.getKey(); } @CheckForNull - static V valueOrNull(@CheckForNull Entry entry) { + static V valueOrNull(@CheckForNull @Readonly Entry entry) { return (entry == null) ? null : entry.getValue(); } - static class SortedKeySet + @ReceiverDependentMutable + static class SortedKeySet extends KeySet implements SortedSet { - SortedKeySet(SortedMap map) { + SortedKeySet(@ReceiverDependentMutable SortedMap map) { super(map); } @Override - SortedMap map() { - return (SortedMap) super.map(); + @PolyMutable SortedMap map(@PolyMutable SortedKeySet this) { + return (@PolyMutable SortedMap) super.map(); } @Override @@ -4127,18 +4168,18 @@ public Comparator comparator() { } @Override - public SortedSet subSet(@ParametricNullness K fromElement, @ParametricNullness K toElement) { - return new SortedKeySet<>(map().subMap(fromElement, toElement)); + public @PolyMutable SortedSet subSet(@PolyMutable SortedKeySet this, @ParametricNullness K fromElement, @ParametricNullness K toElement) { + return new @PolyMutable SortedKeySet<>(map().subMap(fromElement, toElement)); } @Override - public SortedSet headSet(@ParametricNullness K toElement) { - return new SortedKeySet<>(map().headMap(toElement)); + public @PolyMutable SortedSet headSet(@PolyMutable SortedKeySet this, @ParametricNullness K toElement) { + return new @PolyMutable SortedKeySet<>(map().headMap(toElement)); } @Override - public SortedSet tailSet(@ParametricNullness K fromElement) { - return new SortedKeySet<>(map().tailMap(fromElement)); + public @PolyMutable SortedSet tailSet(@PolyMutable SortedKeySet this, @ParametricNullness K fromElement) { + return new @PolyMutable SortedKeySet<>(map().tailMap(fromElement)); } @Override @@ -4155,65 +4196,67 @@ public K last() { } @GwtIncompatible // NavigableMap - static class NavigableKeySet + @ReceiverDependentMutable + static class NavigableKeySet extends SortedKeySet implements NavigableSet { - NavigableKeySet(NavigableMap map) { + NavigableKeySet(@ReceiverDependentMutable NavigableMap map) { super(map); } @Override - NavigableMap map() { - return (NavigableMap) map; + @PolyMutable NavigableMap map(@PolyMutable NavigableKeySet this) { + return (@PolyMutable NavigableMap) map; } @Override @CheckForNull - public K lower(@ParametricNullness K e) { + public K lower(@Readonly NavigableKeySet this, @ParametricNullness K e) { return map().lowerKey(e); } @Override @CheckForNull - public K floor(@ParametricNullness K e) { + public K floor(@Readonly NavigableKeySet this, @ParametricNullness K e) { return map().floorKey(e); } @Override @CheckForNull - public K ceiling(@ParametricNullness K e) { + public K ceiling(@Readonly NavigableKeySet this, @ParametricNullness K e) { return map().ceilingKey(e); } @Override @CheckForNull - public K higher(@ParametricNullness K e) { + public K higher(@Readonly NavigableKeySet this, @ParametricNullness K e) { return map().higherKey(e); } @Override @CheckForNull - public K pollFirst() { + public K pollFirst(@Mutable NavigableKeySet this) { return keyOrNull(map().pollFirstEntry()); } @Override @CheckForNull - public K pollLast() { + public K pollLast(@Mutable NavigableKeySet this) { return keyOrNull(map().pollLastEntry()); } @Override - public NavigableSet descendingSet() { + public @PolyMutable NavigableSet descendingSet(@PolyMutable NavigableKeySet this) { return map().descendingKeySet(); } @Override - public Iterator descendingIterator() { + public Iterator descendingIterator(@PolyMutable NavigableKeySet this) { return descendingSet().iterator(); } @Override - public NavigableSet subSet( + public @PolyMutable NavigableSet subSet( + @PolyMutable NavigableKeySet this, @ParametricNullness K fromElement, boolean fromInclusive, @ParametricNullness K toElement, @@ -4222,57 +4265,58 @@ public NavigableSet subSet( } @Override - public SortedSet subSet(@ParametricNullness K fromElement, @ParametricNullness K toElement) { + public @PolyMutable SortedSet subSet(@PolyMutable NavigableKeySet this, @ParametricNullness K fromElement, @ParametricNullness K toElement) { return subSet(fromElement, true, toElement, false); } @Override - public NavigableSet headSet(@ParametricNullness K toElement, boolean inclusive) { + public @PolyMutable NavigableSet headSet(@PolyMutable NavigableKeySet this, @ParametricNullness K toElement, boolean inclusive) { return map().headMap(toElement, inclusive).navigableKeySet(); } @Override - public SortedSet headSet(@ParametricNullness K toElement) { + public @PolyMutable SortedSet headSet(@PolyMutable NavigableKeySet this, @ParametricNullness K toElement) { return headSet(toElement, false); } @Override - public NavigableSet tailSet(@ParametricNullness K fromElement, boolean inclusive) { + public @PolyMutable NavigableSet tailSet(@PolyMutable NavigableKeySet this, @ParametricNullness K fromElement, boolean inclusive) { return map().tailMap(fromElement, inclusive).navigableKeySet(); } @Override - public SortedSet tailSet(@ParametricNullness K fromElement) { + public @PolyMutable SortedSet tailSet(@PolyMutable NavigableKeySet this, @ParametricNullness K fromElement) { return tailSet(fromElement, true); } } - static class Values + @ReceiverDependentMutable + static class Values extends AbstractCollection { @Weak final Map map; - Values(Map map) { + Values(@ReceiverDependentMutable Map map) { this.map = checkNotNull(map); } - final Map map() { + final @PolyMutable Map map(@PolyMutable Values this) { return map; } @Override - public Iterator iterator() { + public Iterator iterator(@PolyMutable Values this) { return valueIterator(map().entrySet().iterator()); } @Override - public void forEach(Consumer action) { + public void forEach(@Readonly Values this, Consumer action) { checkNotNull(action); // avoids allocation of entries for those maps that generate fresh entries on iteration map.forEach((k, v) -> action.accept(v)); } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable Values this, @CheckForNull @UnknownSignedness @Readonly Object o) { try { return super.remove(o); } catch (UnsupportedOperationException e) { @@ -4287,7 +4331,7 @@ public boolean remove(@CheckForNull @UnknownSignedness Object o) { } @Override - public boolean removeAll(Collection c) { + public boolean removeAll(@Mutable Values this, @Readonly Collection c) { try { return super.removeAll(checkNotNull(c)); } catch (UnsupportedOperationException e) { @@ -4302,7 +4346,7 @@ public boolean removeAll(Collection c) { } @Override - public boolean retainAll(Collection c) { + public boolean retainAll(@Mutable Values this, @Readonly Collection c) { try { return super.retainAll(checkNotNull(c)); } catch (UnsupportedOperationException e) { @@ -4317,42 +4361,43 @@ public boolean retainAll(Collection c) { } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly Values this) { return map().size(); } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly Values this) { return map().isEmpty(); } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly Values this, @CheckForNull @UnknownSignedness @Readonly Object o) { return map().containsValue(o); } @Override - public void clear() { + public void clear(@Mutable Values this) { map().clear(); } } - abstract static class EntrySet - extends Sets.ImprovedAbstractSet> { - abstract Map map(); + @ReceiverDependentMutable + abstract static class EntrySet + extends Sets.ImprovedAbstractSet<@ReceiverDependentMutable Entry> { + abstract @PolyMutable Map map(@PolyMutable EntrySet this); @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly EntrySet this) { return map().size(); } @Override - public void clear() { + public void clear(@Mutable EntrySet this) { map().clear(); } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly EntrySet this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (o instanceof Entry) { Entry entry = (Entry) o; Object key = entry.getKey(); @@ -4363,12 +4408,12 @@ public boolean contains(@CheckForNull @UnknownSignedness Object o) { } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly EntrySet this) { return map().isEmpty(); } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable EntrySet this, @CheckForNull @UnknownSignedness @Readonly Object o) { /* * `o instanceof Entry` is guaranteed by `contains`, but we check it here to satisfy our * nullness checker. @@ -4381,7 +4426,7 @@ public boolean remove(@CheckForNull @UnknownSignedness Object o) { } @Override - public boolean removeAll(Collection c) { + public boolean removeAll(@Mutable EntrySet this, @Readonly Collection c) { try { return super.removeAll(checkNotNull(c)); } catch (UnsupportedOperationException e) { @@ -4391,7 +4436,7 @@ public boolean removeAll(Collection c) { } @Override - public boolean retainAll(Collection c) { + public boolean retainAll(@Mutable EntrySet this, @Readonly Collection c) { try { return super.retainAll(checkNotNull(c)); } catch (UnsupportedOperationException e) { @@ -4413,17 +4458,18 @@ public boolean retainAll(Collection c) { } @GwtIncompatible // NavigableMap - abstract static class DescendingMap + @ReceiverDependentMutable + abstract static class DescendingMap extends ForwardingMap implements NavigableMap { - abstract NavigableMap forward(); + abstract @PolyMutable NavigableMap forward(@PolyMutable DescendingMap this); @Override - protected final Map delegate() { + protected final @PolyMutable Map delegate(@PolyMutable DescendingMap this) { return forward(); } - @CheckForNull private transient Comparator comparator; + @CheckForNull private transient @Mutable Comparator comparator; @SuppressWarnings("unchecked") @Override @@ -4440,110 +4486,110 @@ public Comparator comparator() { } // If we inline this, we get a javac error. - private static Ordering reverse(Comparator forward) { + private static Ordering reverse(Comparator forward) { return Ordering.from(forward).reverse(); } @Override @ParametricNullness - public @KeyFor("this") K firstKey() { + public @KeyFor("this") K firstKey(@Readonly DescendingMap this) { return forward().lastKey(); } @Override @ParametricNullness - public @KeyFor("this") K lastKey() { + public @KeyFor("this") K lastKey(@Readonly DescendingMap this) { return forward().firstKey(); } @Override @CheckForNull - public Entry lowerEntry(@ParametricNullness K key) { + public @PolyMutable Entry lowerEntry(@PolyMutable DescendingMap this, @ParametricNullness K key) { return forward().higherEntry(key); } @Override @CheckForNull - public K lowerKey(@ParametricNullness K key) { + public K lowerKey(@Readonly DescendingMap this, @ParametricNullness K key) { return forward().higherKey(key); } @Override @CheckForNull - public Entry floorEntry(@ParametricNullness K key) { + public @PolyMutable Entry floorEntry(@PolyMutable DescendingMap this, @ParametricNullness K key) { return forward().ceilingEntry(key); } @Override @CheckForNull - public K floorKey(@ParametricNullness K key) { + public K floorKey(@PolyMutable DescendingMap this, @ParametricNullness K key) { return forward().ceilingKey(key); } @Override @CheckForNull - public Entry ceilingEntry(@ParametricNullness K key) { + public @PolyMutable Entry ceilingEntry(@PolyMutable DescendingMap this, @ParametricNullness K key) { return forward().floorEntry(key); } @Override @CheckForNull - public K ceilingKey(@ParametricNullness K key) { + public K ceilingKey(@Readonly DescendingMap this, @ParametricNullness K key) { return forward().floorKey(key); } @Override @CheckForNull - public Entry higherEntry(@ParametricNullness K key) { + public @PolyMutable Entry higherEntry(@PolyMutable DescendingMap this, @ParametricNullness K key) { return forward().lowerEntry(key); } @Override @CheckForNull - public K higherKey(@ParametricNullness K key) { + public K higherKey(@Readonly DescendingMap this, @ParametricNullness K key) { return forward().lowerKey(key); } @Override @CheckForNull - public Entry firstEntry() { + public @PolyMutable Entry firstEntry(@PolyMutable DescendingMap this) { return forward().lastEntry(); } @Override @CheckForNull - public Entry lastEntry() { + public @PolyMutable Entry lastEntry(@PolyMutable DescendingMap this) { return forward().firstEntry(); } @Override @CheckForNull - public Entry pollFirstEntry() { + public Entry pollFirstEntry(@Mutable DescendingMap this) { return forward().pollLastEntry(); } @Override @CheckForNull - public Entry pollLastEntry() { + public Entry pollLastEntry(@Mutable DescendingMap this) { return forward().pollFirstEntry(); } @Override - public NavigableMap descendingMap() { + public @PolyMutable NavigableMap descendingMap(@PolyMutable DescendingMap this) { return forward(); } - @CheckForNull private transient Set> entrySet; + @CheckForNull private transient @Assignable Set<@ReceiverDependentMutable Entry> entrySet; @Override - public Set> entrySet() { - Set> result = entrySet; + public @PolyMutable Set<@PolyMutable Entry<@KeyFor({"this"}) K, V>> entrySet(@PolyMutable DescendingMap this) { + Set<@PolyMutable Entry> result = entrySet; return (result == null) ? entrySet = createEntrySet() : result; } - abstract Iterator> entryIterator(); + abstract Iterator<@PolyMutable Entry> entryIterator(@PolyMutable DescendingMap this); - Set> createEntrySet() { + @PolyMutable Set<@PolyMutable Entry> createEntrySet(@PolyMutable DescendingMap this) { @WeakOuter class EntrySetImpl extends EntrySet { @Override @@ -4560,25 +4606,26 @@ public Iterator> iterator() { } @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable DescendingMap this) { return navigableKeySet(); } - @CheckForNull private transient NavigableSet navigableKeySet; + @CheckForNull private transient @Assignable NavigableSet navigableKeySet; @Override - public NavigableSet<@KeyFor({"this"}) K> navigableKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> navigableKeySet(@PolyMutable DescendingMap this) { NavigableSet result = navigableKeySet; return (result == null) ? navigableKeySet = new NavigableKeySet<>(this) : result; } @Override - public NavigableSet<@KeyFor({"this"}) K> descendingKeySet() { + public @PolyMutable NavigableSet<@KeyFor({"this"}) K> descendingKeySet(@PolyMutable DescendingMap this) { return forward().navigableKeySet(); } @Override - public NavigableMap subMap( + public @PolyMutable NavigableMap subMap( + @PolyMutable DescendingMap this, @ParametricNullness K fromKey, boolean fromInclusive, @ParametricNullness K toKey, @@ -4587,43 +4634,43 @@ public NavigableMap subMap( } @Override - public SortedMap subMap(@ParametricNullness K fromKey, @ParametricNullness K toKey) { + public @PolyMutable SortedMap subMap(@PolyMutable DescendingMap this, @ParametricNullness K fromKey, @ParametricNullness K toKey) { return subMap(fromKey, true, toKey, false); } @Override - public NavigableMap headMap(@ParametricNullness K toKey, boolean inclusive) { + public @PolyMutable NavigableMap headMap(@PolyMutable DescendingMap this, @ParametricNullness K toKey, boolean inclusive) { return forward().tailMap(toKey, inclusive).descendingMap(); } @Override - public SortedMap headMap(@ParametricNullness K toKey) { + public @PolyMutable SortedMap headMap(@PolyMutable DescendingMap this, @ParametricNullness K toKey) { return headMap(toKey, false); } @Override - public NavigableMap tailMap(@ParametricNullness K fromKey, boolean inclusive) { + public @PolyMutable NavigableMap tailMap(@PolyMutable DescendingMap this, @ParametricNullness K fromKey, boolean inclusive) { return forward().headMap(fromKey, inclusive).descendingMap(); } @Override - public SortedMap tailMap(@ParametricNullness K fromKey) { + public @PolyMutable SortedMap tailMap(@PolyMutable DescendingMap this, @ParametricNullness K fromKey) { return tailMap(fromKey, true); } @Override - public Collection values() { - return new Values<>(this); + public @PolyMutable Collection values(@PolyMutable DescendingMap this) { + return new @PolyMutable Values<>(this); } @Override - public String toString() { + public String toString(@Readonly DescendingMap this) { return standardToString(); } } /** Returns a map from the ith element of list to i. */ - static ImmutableMap indexMap(Collection list) { + static ImmutableMap indexMap(@Readonly Collection list) { ImmutableMap.Builder builder = new ImmutableMap.Builder<>(list.size()); int i = 0; for (E e : list) { @@ -4650,8 +4697,8 @@ static ImmutableMap indexMap(Collection list) { */ @Beta @GwtIncompatible // NavigableMap - public static , V extends @Nullable Object> - NavigableMap subMap(NavigableMap map, Range range) { + public static , V extends @Nullable @Readonly Object> + @PolyMutable NavigableMap subMap(@PolyMutable NavigableMap map, Range range) { if (map.comparator() != null && map.comparator() != Ordering.natural() && range.hasLowerBound() diff --git a/guava/src/com/google/common/collect/MinMaxPriorityQueue.java b/guava/src/com/google/common/collect/MinMaxPriorityQueue.java index 61a5336714d8..594000d784f0 100644 --- a/guava/src/com/google/common/collect/MinMaxPriorityQueue.java +++ b/guava/src/com/google/common/collect/MinMaxPriorityQueue.java @@ -46,6 +46,7 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Mutable; import org.checkerframework.checker.signedness.qual.PolySigned; /** diff --git a/guava/src/com/google/common/collect/MoreCollectors.java b/guava/src/com/google/common/collect/MoreCollectors.java index 5a84a4628e3b..d71c7d9f315f 100644 --- a/guava/src/com/google/common/collect/MoreCollectors.java +++ b/guava/src/com/google/common/collect/MoreCollectors.java @@ -26,6 +26,9 @@ import java.util.Optional; import java.util.stream.Collector; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Collectors not present in {@code java.util.stream.Collectors} that are not otherwise associated @@ -34,6 +37,7 @@ * @author Louis Wasserman * @since 21.0 */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault public final class MoreCollectors { @@ -42,7 +46,7 @@ public final class MoreCollectors { * TODO(lowasser): figure out if we can convert this to a concurrent AtomicReference-based * collector without breaking j2cl? */ - private static final Collector> TO_OPTIONAL = + private static final Collector<@Readonly Object, ?, Optional<@Readonly Object>> TO_OPTIONAL = Collector.of( ToOptionalState::new, ToOptionalState::add, @@ -65,8 +69,8 @@ public final class MoreCollectors { private static final Object NULL_PLACEHOLDER = new Object(); - private static final Collector<@Nullable Object, ?, @Nullable Object> ONLY_ELEMENT = - Collector.<@Nullable Object, ToOptionalState, @Nullable Object>of( + private static final Collector<@Nullable @Readonly Object, ?, @Nullable @Readonly Object> ONLY_ELEMENT = + Collector.<@Nullable @Readonly Object, ToOptionalState, @Nullable @Readonly Object>of( ToOptionalState::new, (state, o) -> state.add((o == null) ? NULL_PLACEHOLDER : o), ToOptionalState::combine, @@ -82,7 +86,7 @@ public final class MoreCollectors { * more elements, and a {@code NoSuchElementException} if the stream is empty. */ @SuppressWarnings("unchecked") - public static Collector onlyElement() { + public static Collector onlyElement() { return (Collector) ONLY_ELEMENT; } @@ -94,13 +98,14 @@ private static final class ToOptionalState { static final int MAX_EXTRAS = 4; @Nullable Object element; - List extras; + @Immutable List extras; ToOptionalState() { element = null; extras = emptyList(); } + @SuppressWarnings("pico") // Replaced as mutable list IllegalArgumentException multiples(boolean overflow) { StringBuilder sb = new StringBuilder().append("expected one element but was: <").append(element); @@ -114,6 +119,7 @@ IllegalArgumentException multiples(boolean overflow) { throw new IllegalArgumentException(sb.toString()); } + @SuppressWarnings("pico") // Replaced as mutable list void add(Object o) { checkNotNull(o); if (element == null) { @@ -129,6 +135,7 @@ void add(Object o) { } } + @SuppressWarnings("pico") // Replaced as mutable list ToOptionalState combine(ToOptionalState other) { if (element == null) { return other; diff --git a/guava/src/com/google/common/collect/Multimap.java b/guava/src/com/google/common/collect/Multimap.java index 07d9364a1dc2..fdecbf8a778a 100644 --- a/guava/src/com/google/common/collect/Multimap.java +++ b/guava/src/com/google/common/collect/Multimap.java @@ -30,6 +30,11 @@ import java.util.function.BiConsumer; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -164,9 +169,10 @@ */ @DoNotMock("Use ImmutableMultimap, HashMultimap, or another implementation") @GwtCompatible -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @ElementTypesAreNonnullByDefault -public interface Multimap { +@ReceiverDependentMutable +public interface Multimap { // Query Operations /** @@ -176,37 +182,37 @@ public interface Multimap this); /** * Returns {@code true} if this multimap contains no key-value pairs. Equivalent to {@code size() * == 0}, but can in some cases be more efficient. */ @Pure - boolean isEmpty(); + boolean isEmpty(@Readonly Multimap this); /** * Returns {@code true} if this multimap contains at least one key-value pair with the key {@code * key}. */ @Pure - boolean containsKey(@CompatibleWith("K") @CheckForNull @UnknownSignedness Object key); + boolean containsKey(@Readonly Multimap this, @CompatibleWith("K") @CheckForNull @UnknownSignedness @Readonly Object key); /** * Returns {@code true} if this multimap contains at least one key-value pair with the value * {@code value}. */ @Pure - boolean containsValue(@CompatibleWith("V") @CheckForNull @UnknownSignedness Object value); + boolean containsValue(@Readonly Multimap this, @CompatibleWith("V") @CheckForNull @UnknownSignedness @Readonly Object value); /** * Returns {@code true} if this multimap contains at least one key-value pair with the key {@code * key} and the value {@code value}. */ @Pure - boolean containsEntry( - @CompatibleWith("K") @CheckForNull Object key, - @CompatibleWith("V") @CheckForNull Object value); + boolean containsEntry(@Readonly Multimap this, + @CompatibleWith("K") @CheckForNull @Readonly Object key, + @CompatibleWith("V") @CheckForNull @Readonly Object value); // Modification Operations @@ -221,7 +227,7 @@ boolean containsEntry( * multimap already contained the key-value pair and doesn't allow duplicates */ @CanIgnoreReturnValue - boolean put(@ParametricNullness K key, @ParametricNullness V value); + boolean put(@Mutable Multimap this, @ParametricNullness K key, @ParametricNullness V value); /** * Removes a single key-value pair with the key {@code key} and the value {@code value} from this @@ -232,8 +238,9 @@ boolean containsEntry( */ @CanIgnoreReturnValue boolean remove( - @CompatibleWith("K") @CheckForNull Object key, - @CompatibleWith("V") @CheckForNull Object value); + @Mutable Multimap this, + @CompatibleWith("K") @CheckForNull @Readonly Object key, + @CompatibleWith("V") @CheckForNull @Readonly Object value); // Bulk Operations @@ -252,7 +259,7 @@ boolean remove( * @return {@code true} if the multimap changed */ @CanIgnoreReturnValue - boolean putAll(@ParametricNullness K key, Iterable values); + boolean putAll(@Mutable Multimap this, @ParametricNullness K key, Iterable values); /** * Stores all key-value pairs of {@code multimap} in this multimap, in the order returned by @@ -261,7 +268,7 @@ boolean remove( * @return {@code true} if the multimap changed */ @CanIgnoreReturnValue - boolean putAll(Multimap multimap); + boolean putAll(@Mutable Multimap this, @Readonly Multimap multimap); /** * Stores a collection of values with the same key, replacing any existing values for that key. @@ -273,7 +280,7 @@ boolean remove( * no effect on the multimap. */ @CanIgnoreReturnValue - Collection replaceValues(@ParametricNullness K key, Iterable values); + Collection replaceValues(@Mutable Multimap this, @ParametricNullness K key, Iterable values); /** * Removes all values associated with the key {@code key}. @@ -285,10 +292,10 @@ boolean remove( * modifiable, but updating it will have no effect on the multimap. */ @CanIgnoreReturnValue - Collection removeAll(@CompatibleWith("K") @CheckForNull Object key); + Collection removeAll(@Mutable Multimap this, @CompatibleWith("K") @CheckForNull @Readonly Object key); /** Removes all key-value pairs from the multimap, leaving it {@linkplain #isEmpty empty}. */ - void clear(); + void clear(@Mutable Multimap this); // Views @@ -299,7 +306,7 @@ boolean remove( * *

Changes to the returned collection will update the underlying multimap, and vice versa. */ - Collection get(@ParametricNullness K key); + @PolyMutable Collection get(@PolyMutable Multimap this, @ParametricNullness K key); /** * Returns a view collection of all distinct keys contained in this multimap. Note that the @@ -308,7 +315,7 @@ boolean remove( *

Changes to the returned set will update the underlying multimap, and vice versa. However, * adding to the returned set is not possible. */ - Set keySet(); + @PolyMutable Set keySet(@PolyMutable Multimap this); /** * Returns a view collection containing the key from each key-value pair in this multimap, @@ -318,7 +325,7 @@ boolean remove( *

Changes to the returned multiset will update the underlying multimap, and vice versa. * However, adding to the returned collection is not possible. */ - Multiset keys(); + @PolyMutable Multiset keys(@PolyMutable Multimap this); /** * Returns a view collection containing the value from each key-value pair contained in @@ -327,7 +334,7 @@ boolean remove( *

Changes to the returned collection will update the underlying multimap, and vice versa. * However, adding to the returned collection is not possible. */ - Collection values(); + @PolyMutable Collection values(@PolyMutable Multimap this); /** * Returns a view collection of all key-value pairs contained in this multimap, as {@link Entry} @@ -336,7 +343,7 @@ boolean remove( *

Changes to the returned collection or the entries it contains will update the underlying * multimap, and vice versa. However, adding to the returned collection is not possible. */ - Collection> entries(); + @PolyMutable Collection<@PolyMutable Entry> entries(@PolyMutable Multimap this); /** * Performs the given action for all key-value pairs contained in this multimap. If an ordering is @@ -363,7 +370,7 @@ default void forEach(BiConsumer action) { * underlying multimap, and vice versa. The map does not support {@code put} or {@code putAll}, * nor do its entries support {@link Entry#setValue setValue}. */ - Map> asMap(); + @PolyMutable Map> asMap(@PolyMutable Multimap this); // Comparison and hashing @@ -382,7 +389,7 @@ default void forEach(BiConsumer action) { */ @Pure @Override - boolean equals(@CheckForNull Object obj); + boolean equals(@Readonly Multimap this, @CheckForNull @Readonly Object obj); /** * Returns the hash code for this multimap. @@ -397,5 +404,5 @@ default void forEach(BiConsumer action) { */ @Pure @Override - int hashCode(@UnknownSignedness Multimap this); + int hashCode(@UnknownSignedness @Readonly Multimap this); } diff --git a/guava/src/com/google/common/collect/MultimapBuilder.java b/guava/src/com/google/common/collect/MultimapBuilder.java index 3d6278aaec9d..9ea6a2f72661 100644 --- a/guava/src/com/google/common/collect/MultimapBuilder.java +++ b/guava/src/com/google/common/collect/MultimapBuilder.java @@ -35,6 +35,8 @@ import java.util.TreeMap; import java.util.TreeSet; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; /** * A builder for a multimap implementation that allows customization of the backing map and value @@ -63,7 +65,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class MultimapBuilder { +public abstract class MultimapBuilder { /* * Leaving K and V as upper bounds rather than the actual key and value types allows type * parameters to be left implicit more often. CacheBuilder uses the same technique. @@ -74,7 +76,7 @@ private MultimapBuilder() {} private static final int DEFAULT_EXPECTED_KEYS = 8; /** Uses a hash table to map keys to value collections. */ - public static MultimapBuilderWithKeys<@Nullable Object> hashKeys() { + public static MultimapBuilderWithKeys<@Nullable @Immutable Object> hashKeys() { return hashKeys(DEFAULT_EXPECTED_KEYS); } @@ -84,11 +86,11 @@ private MultimapBuilder() {} * * @throws IllegalArgumentException if {@code expectedKeys < 0} */ - public static MultimapBuilderWithKeys<@Nullable Object> hashKeys(int expectedKeys) { + public static MultimapBuilderWithKeys<@Nullable @Immutable Object> hashKeys(int expectedKeys) { checkNonnegative(expectedKeys, "expectedKeys"); - return new MultimapBuilderWithKeys<@Nullable Object>() { + return new MultimapBuilderWithKeys<@Nullable @Immutable Object>() { @Override - Map> createMap() { + Map> createMap() { return Platform.newHashMapWithExpectedSize(expectedKeys); } }; @@ -102,7 +104,7 @@ private MultimapBuilder() {} * multimap, save that if all values associated with a key are removed and then the key is added * back into the multimap, that key will come last in the key iteration order. */ - public static MultimapBuilderWithKeys<@Nullable Object> linkedHashKeys() { + public static MultimapBuilderWithKeys<@Nullable @Immutable Object> linkedHashKeys() { return linkedHashKeys(DEFAULT_EXPECTED_KEYS); } @@ -115,11 +117,11 @@ private MultimapBuilder() {} * multimap, save that if all values associated with a key are removed and then the key is added * back into the multimap, that key will come last in the key iteration order. */ - public static MultimapBuilderWithKeys<@Nullable Object> linkedHashKeys(int expectedKeys) { + public static MultimapBuilderWithKeys<@Nullable @Immutable Object> linkedHashKeys(int expectedKeys) { checkNonnegative(expectedKeys, "expectedKeys"); - return new MultimapBuilderWithKeys<@Nullable Object>() { + return new MultimapBuilderWithKeys<@Nullable @Immutable Object>() { @Override - Map> createMap() { + Map> createMap() { return Platform.newLinkedHashMapWithExpectedSize(expectedKeys); } }; @@ -153,12 +155,12 @@ public static MultimapBuilderWithKeys treeKeys() { *

Multimaps generated by the resulting builder will not be serializable if {@code comparator} * is not serializable. */ - public static MultimapBuilderWithKeys treeKeys( + public static MultimapBuilderWithKeys treeKeys( Comparator comparator) { checkNotNull(comparator); return new MultimapBuilderWithKeys() { @Override - Map> createMap() { + Map> createMap() { return new TreeMap<>(comparator); } }; @@ -174,7 +176,7 @@ public static > MultimapBuilderWithKeys enumKeys(Class() { @SuppressWarnings("unchecked") @Override - Map> createMap() { + Map> createMap() { // K must actually be K0, since enums are effectively final // (their subclasses are inaccessible) return (Map>) new EnumMap>(keyClass); @@ -182,7 +184,7 @@ public static > MultimapBuilderWithKeys enumKeys(Class + private static final class ArrayListSupplier implements Supplier>, Serializable { private final int expectedValuesPerKey; @@ -199,7 +201,7 @@ public List get() { private enum LinkedListSupplier implements Supplier> { INSTANCE; - public static Supplier> instance() { + public static Supplier> instance() { // Each call generates a fresh LinkedList, which can serve as a List for any V. @SuppressWarnings({"rawtypes", "unchecked"}) Supplier> result = (Supplier) INSTANCE; @@ -212,7 +214,7 @@ public List get() { } } - private static final class HashSetSupplier + private static final class HashSetSupplier implements Supplier>, Serializable { private final int expectedValuesPerKey; @@ -226,7 +228,7 @@ public Set get() { } } - private static final class LinkedHashSetSupplier + private static final class LinkedHashSetSupplier implements Supplier>, Serializable { private final int expectedValuesPerKey; @@ -240,7 +242,7 @@ public Set get() { } } - private static final class TreeSetSupplier + private static final class TreeSetSupplier implements Supplier>, Serializable { private final Comparator comparator; @@ -275,13 +277,13 @@ public Set get() { * @param The upper bound on the key type of the generated multimap. * @since 16.0 */ - public abstract static class MultimapBuilderWithKeys { + public abstract static class MultimapBuilderWithKeys { private static final int DEFAULT_EXPECTED_VALUES_PER_KEY = 2; MultimapBuilderWithKeys() {} - abstract Map> createMap(); + abstract Map> createMap(); /** Uses an {@link ArrayList} to store value collections. */ public ListMultimapBuilder arrayListValues() { @@ -298,7 +300,7 @@ public abstract static class MultimapBuilderWithKeys() { @Override - public ListMultimap build() { + public ListMultimap build() { return Multimaps.newListMultimap( MultimapBuilderWithKeys.this.createMap(), new ArrayListSupplier(expectedValuesPerKey)); @@ -310,7 +312,7 @@ public abstract static class MultimapBuilderWithKeys linkedListValues() { return new ListMultimapBuilder() { @Override - public ListMultimap build() { + public ListMultimap build() { return Multimaps.newListMultimap( MultimapBuilderWithKeys.this.createMap(), LinkedListSupplier.instance()); } @@ -332,7 +334,7 @@ public abstract static class MultimapBuilderWithKeys() { @Override - public SetMultimap build() { + public SetMultimap build() { return Multimaps.newSetMultimap( MultimapBuilderWithKeys.this.createMap(), new HashSetSupplier(expectedValuesPerKey)); @@ -355,7 +357,7 @@ public abstract static class MultimapBuilderWithKeys() { @Override - public SetMultimap build() { + public SetMultimap build() { return Multimaps.newSetMultimap( MultimapBuilderWithKeys.this.createMap(), new LinkedHashSetSupplier(expectedValuesPerKey)); @@ -380,7 +382,7 @@ public SortedSetMultimapBuilder treeSetValues() { checkNotNull(comparator, "comparator"); return new SortedSetMultimapBuilder() { @Override - public SortedSetMultimap build() { + public SortedSetMultimap build() { return Multimaps.newSortedSetMultimap( MultimapBuilderWithKeys.this.createMap(), new TreeSetSupplier(comparator)); } @@ -392,7 +394,7 @@ public > SetMultimapBuilder enumSetValues(Class checkNotNull(valueClass, "valueClass"); return new SetMultimapBuilder() { @Override - public SetMultimap build() { + public SetMultimap build() { // V must actually be V0, since enums are effectively final // (their subclasses are inaccessible) @SuppressWarnings({"unchecked", "rawtypes"}) @@ -423,7 +425,7 @@ public Multimap build( * @since 16.0 */ public abstract static class ListMultimapBuilder< - K0 extends @Nullable Object, V0 extends @Nullable Object> + K0 extends @Nullable @Immutable Object, V0 extends @Nullable Object> extends MultimapBuilder { ListMultimapBuilder() {} @@ -443,7 +445,7 @@ public ListMultimap build( * @since 16.0 */ public abstract static class SetMultimapBuilder< - K0 extends @Nullable Object, V0 extends @Nullable Object> + K0 extends @Nullable @Immutable Object, V0 extends @Nullable Object> extends MultimapBuilder { SetMultimapBuilder() {} @@ -463,7 +465,7 @@ public SetMultimap build( * @since 16.0 */ public abstract static class SortedSetMultimapBuilder< - K0 extends @Nullable Object, V0 extends @Nullable Object> + K0 extends @Nullable @Immutable Object, V0 extends @Nullable Object> extends SetMultimapBuilder { SortedSetMultimapBuilder() {} diff --git a/guava/src/com/google/common/collect/Multimaps.java b/guava/src/com/google/common/collect/Multimaps.java index 9a7fec20152f..2d6b35420415 100644 --- a/guava/src/com/google/common/collect/Multimaps.java +++ b/guava/src/com/google/common/collect/Multimaps.java @@ -60,10 +60,17 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * Provides static methods acting on or generating a {@code Multimap}. @@ -121,9 +128,9 @@ private Multimaps() {} * @since 21.0 */ public static < - T extends @Nullable Object, - K extends @Nullable Object, - V extends @Nullable Object, + T extends @Nullable @Readonly Object, + K extends @Nullable @Immutable Object, + V extends @Nullable @Readonly Object, M extends Multimap> Collector toMultimap( java.util.function.Function keyFunction, @@ -167,9 +174,9 @@ private Multimaps() {} */ @Beta public static < - T extends @Nullable Object, - K extends @Nullable Object, - V extends @Nullable Object, + T extends @Nullable @Readonly Object, + K extends @Nullable @Immutable Object, + V extends @Nullable @Readonly Object, M extends Multimap> Collector flatteningToMultimap( java.util.function.Function keyFunction, @@ -214,38 +221,39 @@ private Multimaps() {} * key * @throws IllegalArgumentException if {@code map} is not empty */ - public static Multimap newMultimap( + public static Multimap newMultimap( Map> map, final Supplier> factory) { return new CustomMultimap<>(map, factory); } - private static class CustomMultimap + @ReceiverDependentMutable + private static class CustomMultimap extends AbstractMapBasedMultimap { - transient Supplier> factory; + transient Supplier> factory; - CustomMultimap(Map> map, Supplier> factory) { + CustomMultimap(@ReceiverDependentMutable Map> map, Supplier> factory) { super(map); this.factory = checkNotNull(factory); } @Override - Set createKeySet() { + @PolyMutable Set createKeySet(@PolyMutable CustomMultimap this) { return createMaybeNavigableKeySet(); } @Override - Map> createAsMap() { + @PolyMutable Map> createAsMap(@PolyMutable CustomMultimap this) { return createMaybeNavigableAsMap(); } @Override - protected Collection createCollection() { + protected @PolyMutable Collection createCollection(@PolyMutable CustomMultimap this) { return factory.get(); } @Override - Collection unmodifiableCollectionSubclass( - Collection collection) { + @Readonly Collection unmodifiableCollectionSubclass( + @Readonly Collection collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet) collection); } else if (collection instanceof SortedSet) { @@ -328,33 +336,34 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo * @param factory supplier of new, empty lists that will each hold all values for a given key * @throws IllegalArgumentException if {@code map} is not empty */ - public static + public static ListMultimap newListMultimap( Map> map, final Supplier> factory) { return new CustomListMultimap<>(map, factory); } - private static class CustomListMultimap + @ReceiverDependentMutable + private static class CustomListMultimap extends AbstractListMultimap { - transient Supplier> factory; + transient Supplier> factory; - CustomListMultimap(Map> map, Supplier> factory) { + CustomListMultimap(@ReceiverDependentMutable Map> map, Supplier> factory) { super(map); this.factory = checkNotNull(factory); } @Override - Set createKeySet() { + @PolyMutable Set createKeySet(@PolyMutable CustomListMultimap this) { return createMaybeNavigableKeySet(); } @Override - Map> createAsMap() { + @PolyMutable Map> createAsMap(@PolyMutable CustomListMultimap this) { return createMaybeNavigableAsMap(); } @Override - protected List createCollection() { + protected @ReceiverDependentMutable List createCollection(@PolyMutable CustomListMultimap this) { return factory.get(); } @@ -408,38 +417,39 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo * @param factory supplier of new, empty sets that will each hold all values for a given key * @throws IllegalArgumentException if {@code map} is not empty */ - public static + public static SetMultimap newSetMultimap( Map> map, final Supplier> factory) { return new CustomSetMultimap<>(map, factory); } - private static class CustomSetMultimap + @ReceiverDependentMutable + private static class CustomSetMultimap extends AbstractSetMultimap { - transient Supplier> factory; + transient Supplier> factory; - CustomSetMultimap(Map> map, Supplier> factory) { + CustomSetMultimap(@ReceiverDependentMutable Map> map, Supplier> factory) { super(map); this.factory = checkNotNull(factory); } @Override - Set createKeySet() { + @PolyMutable Set createKeySet(@PolyMutable CustomSetMultimap this) { return createMaybeNavigableKeySet(); } @Override - Map> createAsMap() { + @PolyMutable Map> createAsMap(@PolyMutable CustomSetMultimap this) { return createMaybeNavigableAsMap(); } @Override - protected Set createCollection() { + protected @PolyMutable Set createCollection(@PolyMutable CustomSetMultimap this) { return factory.get(); } @Override - Collection unmodifiableCollectionSubclass( + @Readonly Collection unmodifiableCollectionSubclass( Collection collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet) collection); @@ -451,13 +461,13 @@ protected Set createCollection() { } @Override - Collection wrapCollection(@ParametricNullness K key, Collection collection) { + @PolyMutable Collection wrapCollection(@ParametricNullness K key, @PolyMutable Collection collection) { if (collection instanceof NavigableSet) { - return new WrappedNavigableSet(key, (NavigableSet) collection, null); + return new @PolyMutable WrappedNavigableSet(key, (NavigableSet) collection, null); } else if (collection instanceof SortedSet) { - return new WrappedSortedSet(key, (SortedSet) collection, null); + return new @PolyMutable WrappedSortedSet(key, (SortedSet) collection, null); } else { - return new WrappedSet(key, (Set) collection); + return new @PolyMutable WrappedSet(key, (Set) collection); } } @@ -511,36 +521,37 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo * key * @throws IllegalArgumentException if {@code map} is not empty */ - public static + public static SortedSetMultimap newSortedSetMultimap( Map> map, final Supplier> factory) { return new CustomSortedSetMultimap<>(map, factory); } + @ReceiverDependentMutable private static class CustomSortedSetMultimap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends AbstractSortedSetMultimap { - transient Supplier> factory; - @CheckForNull transient Comparator valueComparator; + transient Supplier> factory; + @CheckForNull transient @Mutable Comparator valueComparator; - CustomSortedSetMultimap(Map> map, Supplier> factory) { + CustomSortedSetMultimap(@ReceiverDependentMutable Map> map, Supplier> factory) { super(map); this.factory = checkNotNull(factory); valueComparator = factory.get().comparator(); } @Override - Set createKeySet() { + @PolyMutable Set createKeySet(@PolyMutable CustomSortedSetMultimap this) { return createMaybeNavigableKeySet(); } @Override - Map> createAsMap() { + @PolyMutable Map> createAsMap(@PolyMutable CustomSortedSetMultimap this) { return createMaybeNavigableAsMap(); } @Override - protected SortedSet createCollection() { + protected @PolyMutable SortedSet createCollection(@PolyMutable CustomSortedSetMultimap this) { return factory.get(); } @@ -584,7 +595,7 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo * @return {@code dest} */ @CanIgnoreReturnValue - public static > + public static > M invertFrom(Multimap source, M dest) { checkNotNull(dest); for (Map.Entry entry : source.entries()) { @@ -625,7 +636,7 @@ M invertFrom(Multimap source, M dest) { * @param multimap the multimap to be wrapped in a synchronized view * @return a synchronized view of the specified multimap */ - public static + public static Multimap synchronizedMultimap(Multimap multimap) { return Synchronized.multimap(multimap, null); } @@ -641,8 +652,8 @@ Multimap synchronizedMultimap(Multimap multimap) { * @param delegate the multimap for which an unmodifiable view is to be returned * @return an unmodifiable view of the specified multimap */ - public static - Multimap unmodifiableMultimap(Multimap delegate) { + public static + @Readonly Multimap unmodifiableMultimap(@Readonly Multimap delegate) { if (delegate instanceof UnmodifiableMultimap || delegate instanceof ImmutableMultimap) { return delegate; } @@ -656,25 +667,26 @@ Multimap unmodifiableMultimap(Multimap delegate) { * @since 10.0 */ @Deprecated - public static Multimap unmodifiableMultimap(ImmutableMultimap delegate) { + public static @Readonly Multimap unmodifiableMultimap(ImmutableMultimap delegate) { return checkNotNull(delegate); } - private static class UnmodifiableMultimap - extends ForwardingMultimap implements Serializable { - final Multimap delegate; - @LazyInit @CheckForNull transient Collection> entries; - @LazyInit @CheckForNull transient Multiset keys; - @LazyInit @CheckForNull transient Set keySet; - @LazyInit @CheckForNull transient Collection values; - @LazyInit @CheckForNull transient Map> map; - - UnmodifiableMultimap(final Multimap delegate) { + @Immutable + private static class UnmodifiableMultimap + extends ForwardingMultimap implements Serializable { + final @Readonly Multimap delegate; + @LazyInit @CheckForNull transient @Assignable @Readonly Collection<@Readonly Entry> entries; + @LazyInit @CheckForNull transient @Assignable @Readonly Multiset keys; + @LazyInit @CheckForNull transient @Assignable @Readonly Set keySet; + @LazyInit @CheckForNull transient @Assignable @Readonly Collection values; + @LazyInit @CheckForNull transient @Assignable @Readonly Map> map; + + UnmodifiableMultimap(final @Readonly Multimap delegate) { this.delegate = checkNotNull(delegate); } @Override - protected Multimap delegate() { + protected @Readonly Multimap delegate() { return delegate; } @@ -684,8 +696,8 @@ public void clear() { } @Override - public Map> asMap() { - Map> result = map; + public @Readonly Map> asMap() { + Map> result = map; if (result == null) { result = map = @@ -704,8 +716,8 @@ public Collection apply(Collection collection) { @SideEffectFree @Override - public Collection> entries() { - Collection> result = entries; + public @Readonly Collection<@Readonly Entry> entries() { + Collection<@Readonly Entry> result = entries; if (result == null) { entries = result = unmodifiableEntries(delegate.entries()); } @@ -718,12 +730,12 @@ public void forEach(BiConsumer consumer) { } @Override - public Collection get(@ParametricNullness K key) { + public @Readonly Collection get(@ParametricNullness K key) { return unmodifiableValueCollection(delegate.get(key)); } @Override - public Multiset keys() { + public @Readonly Multiset keys() { Multiset result = keys; if (result == null) { keys = result = Multisets.unmodifiableMultiset(delegate.keys()); @@ -733,7 +745,7 @@ public Multiset keys() { @SideEffectFree @Override - public Set keySet() { + public @Readonly Set keySet() { Set result = keySet; if (result == null) { keySet = result = Collections.unmodifiableSet(delegate.keySet()); @@ -757,23 +769,23 @@ public boolean putAll(Multimap multimap) { } @Override - public boolean remove(@CheckForNull Object key, @CheckForNull Object value) { + public boolean remove(@CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { throw new UnsupportedOperationException(); } @Override - public Collection removeAll(@CheckForNull Object key) { + public @Readonly Collection removeAll(@CheckForNull @Readonly Object key) { throw new UnsupportedOperationException(); } @Override - public Collection replaceValues(@ParametricNullness K key, Iterable values) { + public @Readonly Collection replaceValues(@ParametricNullness K key, Iterable values) { throw new UnsupportedOperationException(); } @SideEffectFree @Override - public Collection values() { + public @Readonly Collection values() { Collection result = values; if (result == null) { values = result = Collections.unmodifiableCollection(delegate.values()); @@ -784,50 +796,52 @@ public Collection values() { private static final long serialVersionUID = 0; } + @Immutable private static class UnmodifiableListMultimap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends UnmodifiableMultimap implements ListMultimap { - UnmodifiableListMultimap(ListMultimap delegate) { + UnmodifiableListMultimap(@Readonly ListMultimap delegate) { super(delegate); } @Override - public ListMultimap delegate() { - return (ListMultimap) super.delegate(); + public @Readonly ListMultimap delegate() { + return (@Readonly ListMultimap) super.delegate(); } @Override - public List get(@ParametricNullness K key) { + public @Readonly List get(@ParametricNullness K key) { return Collections.unmodifiableList(delegate().get(key)); } @Override - public List removeAll(@CheckForNull Object key) { + public @Readonly List removeAll(@CheckForNull @Readonly Object key) { throw new UnsupportedOperationException(); } @Override - public List replaceValues(@ParametricNullness K key, Iterable values) { + public @Readonly List replaceValues(@ParametricNullness K key, Iterable values) { throw new UnsupportedOperationException(); } private static final long serialVersionUID = 0; } + @Immutable private static class UnmodifiableSetMultimap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends UnmodifiableMultimap implements SetMultimap { - UnmodifiableSetMultimap(SetMultimap delegate) { + UnmodifiableSetMultimap(@Readonly SetMultimap delegate) { super(delegate); } @Override - public SetMultimap delegate() { - return (SetMultimap) super.delegate(); + public @Readonly SetMultimap delegate() { + return (@Readonly SetMultimap) super.delegate(); } @Override - public Set get(@ParametricNullness K key) { + public @Readonly Set get(@ParametricNullness K key) { /* * Note that this doesn't return a SortedSet when delegate is a * SortedSetMultiset, unlike (SortedSet) super.get(). @@ -837,47 +851,48 @@ public Set get(@ParametricNullness K key) { @SideEffectFree @Override - public Set> entries() { + public @Readonly Set> entries() { return Maps.unmodifiableEntrySet(delegate().entries()); } @Override - public Set removeAll(@CheckForNull Object key) { + public @Readonly Set removeAll(@CheckForNull @Readonly Object key) { throw new UnsupportedOperationException(); } @Override - public Set replaceValues(@ParametricNullness K key, Iterable values) { + public @Readonly Set replaceValues(@ParametricNullness K key, Iterable values) { throw new UnsupportedOperationException(); } private static final long serialVersionUID = 0; } + @Immutable private static class UnmodifiableSortedSetMultimap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends UnmodifiableSetMultimap implements SortedSetMultimap { - UnmodifiableSortedSetMultimap(SortedSetMultimap delegate) { + UnmodifiableSortedSetMultimap(@Readonly SortedSetMultimap delegate) { super(delegate); } @Override - public SortedSetMultimap delegate() { - return (SortedSetMultimap) super.delegate(); + public @Readonly SortedSetMultimap delegate() { + return (@Readonly SortedSetMultimap) super.delegate(); } @Override - public SortedSet get(@ParametricNullness K key) { + public @Readonly SortedSet get(@ParametricNullness K key) { return Collections.unmodifiableSortedSet(delegate().get(key)); } @Override - public SortedSet removeAll(@CheckForNull Object key) { + public @Readonly SortedSet removeAll(@CheckForNull @Readonly Object key) { throw new UnsupportedOperationException(); } @Override - public SortedSet replaceValues(@ParametricNullness K key, Iterable values) { + public @Readonly SortedSet replaceValues(@ParametricNullness K key, Iterable values) { throw new UnsupportedOperationException(); } @@ -900,7 +915,7 @@ public Comparator valueComparator() { * @param multimap the multimap to be wrapped * @return a synchronized view of the specified multimap */ - public static + public static SetMultimap synchronizedSetMultimap(SetMultimap multimap) { return Synchronized.setMultimap(multimap, null); } @@ -916,8 +931,8 @@ SetMultimap synchronizedSetMultimap(SetMultimap multimap) { * @param delegate the multimap for which an unmodifiable view is to be returned * @return an unmodifiable view of the specified multimap */ - public static - SetMultimap unmodifiableSetMultimap(SetMultimap delegate) { + public static + @Readonly SetMultimap unmodifiableSetMultimap(@Readonly SetMultimap delegate) { if (delegate instanceof UnmodifiableSetMultimap || delegate instanceof ImmutableSetMultimap) { return delegate; } @@ -931,8 +946,8 @@ SetMultimap unmodifiableSetMultimap(SetMultimap delegate) { * @since 10.0 */ @Deprecated - public static SetMultimap unmodifiableSetMultimap( - ImmutableSetMultimap delegate) { + public static @Readonly SetMultimap unmodifiableSetMultimap( + ImmutableSetMultimap delegate) { return checkNotNull(delegate); } @@ -947,7 +962,7 @@ public static SetMultimap unmodifiableSetMultimap( * @param multimap the multimap to be wrapped * @return a synchronized view of the specified multimap */ - public static + public static SortedSetMultimap synchronizedSortedSetMultimap(SortedSetMultimap multimap) { return Synchronized.sortedSetMultimap(multimap, null); } @@ -963,8 +978,8 @@ SortedSetMultimap synchronizedSortedSetMultimap(SortedSetMultimap mu * @param delegate the multimap for which an unmodifiable view is to be returned * @return an unmodifiable view of the specified multimap */ - public static - SortedSetMultimap unmodifiableSortedSetMultimap(SortedSetMultimap delegate) { + public static + @Readonly SortedSetMultimap unmodifiableSortedSetMultimap(@Readonly SortedSetMultimap delegate) { if (delegate instanceof UnmodifiableSortedSetMultimap) { return delegate; } @@ -979,7 +994,7 @@ SortedSetMultimap unmodifiableSortedSetMultimap(SortedSetMultimap de * @param multimap the multimap to be wrapped * @return a synchronized view of the specified multimap */ - public static + public static ListMultimap synchronizedListMultimap(ListMultimap multimap) { return Synchronized.listMultimap(multimap, null); } @@ -995,8 +1010,8 @@ ListMultimap synchronizedListMultimap(ListMultimap multimap) { * @param delegate the multimap for which an unmodifiable view is to be returned * @return an unmodifiable view of the specified multimap */ - public static - ListMultimap unmodifiableListMultimap(ListMultimap delegate) { + public static + @Readonly ListMultimap unmodifiableListMultimap(@Readonly ListMultimap delegate) { if (delegate instanceof UnmodifiableListMultimap || delegate instanceof ImmutableListMultimap) { return delegate; } @@ -1010,8 +1025,8 @@ ListMultimap unmodifiableListMultimap(ListMultimap delegate) { * @since 10.0 */ @Deprecated - public static ListMultimap unmodifiableListMultimap( - ImmutableListMultimap delegate) { + public static ListMultimap unmodifiableListMultimap( + ImmutableListMultimap delegate) { return checkNotNull(delegate); } @@ -1023,8 +1038,8 @@ public static ListMultimap unmodifiableListMultimap( * @param collection the collection for which to return an unmodifiable view * @return an unmodifiable view of the collection */ - private static Collection unmodifiableValueCollection( - Collection collection) { + private static @Readonly Collection unmodifiableValueCollection( + @Readonly Collection collection) { if (collection instanceof SortedSet) { return Collections.unmodifiableSortedSet((SortedSet) collection); } else if (collection instanceof Set) { @@ -1043,10 +1058,10 @@ public static ListMultimap unmodifiableListMultimap( * @param entries the entries for which to return an unmodifiable view * @return an unmodifiable view of the entries */ - private static - Collection> unmodifiableEntries(Collection> entries) { + private static + @Readonly Collection<@Readonly Entry> unmodifiableEntries(@Readonly Collection> entries) { if (entries instanceof Set) { - return Maps.unmodifiableEntrySet((Set>) entries); + return Maps.unmodifiableEntrySet((Set<@Readonly Entry>) entries); } return new Maps.UnmodifiableEntries<>(Collections.unmodifiableCollection(entries)); } @@ -1060,9 +1075,9 @@ Collection> unmodifiableEntries(Collection> entries) { @Beta @SuppressWarnings("unchecked") // safe by specification of ListMultimap.asMap() - public static Map> asMap( - ListMultimap multimap) { - return (Map>) (Map) multimap.asMap(); + public static @PolyMutable Map> asMap( + @PolyMutable ListMultimap multimap) { + return (@PolyMutable Map>) (@PolyMutable Map) multimap.asMap(); } /** @@ -1074,9 +1089,9 @@ Collection> unmodifiableEntries(Collection> entries) { @Beta @SuppressWarnings("unchecked") // safe by specification of SetMultimap.asMap() - public static Map> asMap( - SetMultimap multimap) { - return (Map>) (Map) multimap.asMap(); + public static @PolyMutable Map> asMap( + @PolyMutable SetMultimap multimap) { + return (@PolyMutable Map>) (@PolyMutable Map) multimap.asMap(); } /** @@ -1088,9 +1103,9 @@ Collection> unmodifiableEntries(Collection> entries) { @Beta @SuppressWarnings("unchecked") // safe by specification of SortedSetMultimap.asMap() - public static Map> asMap( - SortedSetMultimap multimap) { - return (Map>) (Map) multimap.asMap(); + public static @PolyMutable Map> asMap( + @PolyMutable SortedSetMultimap multimap) { + return (@PolyMutable Map>) (@PolyMutable Map) multimap.asMap(); } /** @@ -1100,8 +1115,8 @@ Collection> unmodifiableEntries(Collection> entries) { * @since 15.0 */ @Beta - public static - Map> asMap(Multimap multimap) { + public static + @PolyMutable Map> asMap(@PolyMutable Multimap multimap) { return multimap.asMap(); } @@ -1120,47 +1135,49 @@ Map> asMap(Multimap multimap) { * * @param map the backing map for the returned multimap view */ - public static SetMultimap forMap( + public static SetMultimap forMap( Map map) { return new MapMultimap<>(map); } /** @see Multimaps#forMap */ - private static class MapMultimap + @ReceiverDependentMutable + @CFComment("PICO: V is immutable because it is used as hashset's element") + private static class MapMultimap extends AbstractMultimap implements SetMultimap, Serializable { final Map map; - MapMultimap(Map map) { + MapMultimap(@ReceiverDependentMutable Map map) { this.map = checkNotNull(map); } @Pure @Override - public int size() { + public int size(@Readonly MapMultimap this) { return map.size(); } @Pure @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly MapMultimap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return map.containsKey(key); } @Pure @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly MapMultimap this, @CheckForNull @UnknownSignedness @Readonly Object value) { return map.containsValue(value); } @Pure @Override - public boolean containsEntry(@CheckForNull Object key, @CheckForNull Object value) { + public boolean containsEntry(@Readonly MapMultimap this, @CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { return map.entrySet().contains(Maps.immutableEntry(key, value)); } @Override - public Set get(@ParametricNullness final K key) { - return new Sets.ImprovedAbstractSet() { + public @PolyMutable Set get(@PolyMutable MapMultimap this, @ParametricNullness final K key) { + return new Sets.@PolyMutable ImprovedAbstractSet() { @Override public Iterator iterator() { return new Iterator() { @@ -1213,22 +1230,22 @@ public boolean putAll(@ParametricNullness K key, Iterable values) { } @Override - public boolean putAll(Multimap multimap) { + public boolean putAll(@Readonly Multimap multimap) { throw new UnsupportedOperationException(); } @Override - public Set replaceValues(@ParametricNullness K key, Iterable values) { + public @Readonly Set replaceValues(@ParametricNullness K key, Iterable values) { throw new UnsupportedOperationException(); } @Override - public boolean remove(@CheckForNull Object key, @CheckForNull Object value) { + public boolean remove(@Mutable MapMultimap this, @CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { return map.entrySet().remove(Maps.immutableEntry(key, value)); } @Override - public Set removeAll(@CheckForNull Object key) { + public @Readonly Set removeAll(@Mutable MapMultimap this, @CheckForNull @Readonly Object key) { Set values = new HashSet(2); if (!map.containsKey(key)) { return values; @@ -1238,51 +1255,51 @@ public Set removeAll(@CheckForNull Object key) { } @Override - public void clear() { + public void clear(@Mutable MapMultimap this) { map.clear(); } @SideEffectFree @Override - Set createKeySet() { + @PolyMutable Set createKeySet(@PolyMutable MapMultimap this) { return map.keySet(); } @SideEffectFree @Override - Collection createValues() { + @PolyMutable Collection createValues(@PolyMutable MapMultimap this) { return map.values(); } @SideEffectFree @Override - public Set> entries() { + public @PolyMutable Set<@PolyMutable Entry> entries(@PolyMutable MapMultimap this) { return map.entrySet(); } @Override - Collection> createEntries() { + @PolyMutable Collection<@PolyMutable Entry> createEntries(@PolyMutable MapMultimap this) { throw new AssertionError("unreachable"); } @Override - Multiset createKeys() { + @PolyMutable Multiset createKeys(@PolyMutable MapMultimap this) { return new Multimaps.Keys(this); } @Override - Iterator> entryIterator() { + Iterator<@PolyMutable Entry> entryIterator(@PolyMutable MapMultimap this) { return map.entrySet().iterator(); } @Override - Map> createAsMap() { + @PolyMutable Map> createAsMap(@PolyMutable MapMultimap this) { return new AsMap<>(this); } @Pure @Override - public int hashCode(@UnknownSignedness MapMultimap this) { + public int hashCode(@UnknownSignedness @Readonly MapMultimap this) { return map.hashCode(); } @@ -1331,7 +1348,7 @@ public int hashCode(@UnknownSignedness MapMultimap this) { * @since 7.0 */ public static < - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> Multimap transformValues( Multimap fromMultimap, final Function function) { checkNotNull(function); @@ -1380,7 +1397,7 @@ Multimap transformValues( * @since 7.0 */ public static < - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> ListMultimap transformValues( ListMultimap fromMultimap, final Function function) { checkNotNull(function); @@ -1440,7 +1457,7 @@ ListMultimap transformValues( * @since 7.0 */ public static < - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> Multimap transformEntries( Multimap fromMap, EntryTransformer transformer) { return new TransformedEntriesMultimap<>(fromMap, transformer); @@ -1495,21 +1512,22 @@ Multimap transformEntries( * @since 7.0 */ public static < - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> ListMultimap transformEntries( ListMultimap fromMap, EntryTransformer transformer) { return new TransformedEntriesListMultimap<>(fromMap, transformer); } + @ReceiverDependentMutable private static class TransformedEntriesMultimap< - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> extends AbstractMultimap { final Multimap fromMultimap; final EntryTransformer transformer; TransformedEntriesMultimap( - Multimap fromMultimap, - final EntryTransformer transformer) { + @ReceiverDependentMutable Multimap fromMultimap, + final @ReceiverDependentMutable EntryTransformer transformer) { this.fromMultimap = checkNotNull(fromMultimap); this.transformer = checkNotNull(transformer); } @@ -1524,55 +1542,55 @@ Collection transform(@ParametricNullness K key, Collection values) { } @Override - Map> createAsMap() { + @PolyMutable Map> createAsMap(@PolyMutable TransformedEntriesMultimap this) { return Maps.transformEntries( fromMultimap.asMap(), new EntryTransformer, Collection>() { @Override - public Collection transformEntry(@ParametricNullness K key, Collection value) { + public @PolyMutable Collection transformEntry(@ParametricNullness K key, @PolyMutable Collection value) { return transform(key, value); } }); } @Override - public void clear() { + public void clear(@Mutable TransformedEntriesMultimap this) { fromMultimap.clear(); } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly TransformedEntriesMultimap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return fromMultimap.containsKey(key); } @Override - Collection> createEntries() { + @PolyMutable Collection<@PolyMutable Entry> createEntries(@PolyMutable TransformedEntriesMultimap this) { return new Entries(); } @Override - Iterator> entryIterator() { + Iterator<@PolyMutable Entry> entryIterator(@PolyMutable TransformedEntriesMultimap this) { return Iterators.transform( fromMultimap.entries().iterator(), Maps.asEntryToEntryFunction(transformer)); } @Override - public Collection get(@ParametricNullness final K key) { + public @PolyMutable Collection get(@PolyMutable TransformedEntriesMultimap this, @ParametricNullness final K key) { return transform(key, fromMultimap.get(key)); } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly TransformedEntriesMultimap this) { return fromMultimap.isEmpty(); } @Override - Set createKeySet() { + @PolyMutable Set createKeySet(@PolyMutable TransformedEntriesMultimap this) { return fromMultimap.keySet(); } @Override - Multiset createKeys() { + @PolyMutable Multiset createKeys(@PolyMutable TransformedEntriesMultimap this) { return fromMultimap.keys(); } @@ -1593,60 +1611,61 @@ public boolean putAll(Multimap multimap) { @SuppressWarnings("unchecked") @Override - public boolean remove(@CheckForNull Object key, @CheckForNull Object value) { + public boolean remove(@CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { return get((K) key).remove(value); } @SuppressWarnings("unchecked") @Override - public Collection removeAll(@CheckForNull Object key) { + public @Readonly Collection removeAll(@Mutable TransformedEntriesMultimap this, @CheckForNull @Readonly Object key) { return transform((K) key, fromMultimap.removeAll(key)); } @Override - public Collection replaceValues(@ParametricNullness K key, Iterable values) { + public @Readonly Collection replaceValues(@ParametricNullness K key, Iterable values) { throw new UnsupportedOperationException(); } @Override - public int size() { + public int size(@Readonly TransformedEntriesMultimap this) { return fromMultimap.size(); } @Override - Collection createValues() { + @PolyMutable Collection createValues(@PolyMutable TransformedEntriesMultimap this) { return Collections2.transform( fromMultimap.entries(), Maps.asEntryToValueFunction(transformer)); } } + @ReceiverDependentMutable private static final class TransformedEntriesListMultimap< - K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object> + K extends @Nullable @Immutable Object, V1 extends @Nullable @Readonly Object, V2 extends @Nullable @Readonly Object> extends TransformedEntriesMultimap implements ListMultimap { TransformedEntriesListMultimap( - ListMultimap fromMultimap, EntryTransformer transformer) { + @ReceiverDependentMutable ListMultimap fromMultimap, @ReceiverDependentMutable EntryTransformer transformer) { super(fromMultimap, transformer); } @Override - List transform(@ParametricNullness K key, Collection values) { + @PolyMutable List transform(@ParametricNullness K key, @PolyMutable Collection values) { return Lists.transform((List) values, Maps.asValueToValueFunction(transformer, key)); } @Override - public List get(@ParametricNullness K key) { + public @PolyMutable List get(@PolyMutable TransformedEntriesListMultimap this, @ParametricNullness K key) { return transform(key, fromMultimap.get(key)); } @SuppressWarnings("unchecked") @Override - public List removeAll(@CheckForNull Object key) { + public @Readonly List removeAll(@Mutable TransformedEntriesListMultimap this, @CheckForNull @Readonly Object key) { return transform((K) key, fromMultimap.removeAll(key)); } @Override - public List replaceValues(@ParametricNullness K key, Iterable values) { + public @Readonly List replaceValues(@ParametricNullness K key, Iterable values) { throw new UnsupportedOperationException(); } } @@ -1686,7 +1705,7 @@ public List replaceValues(@ParametricNullness K key, Iterable * @throws NullPointerException if any element of {@code values} is {@code null}, or if {@code * keyFunction} produces {@code null} for any key */ - public static ImmutableListMultimap index( + public static ImmutableListMultimap index( Iterable values, Function keyFunction) { return index(values.iterator(), keyFunction); } @@ -1727,10 +1746,10 @@ public static ImmutableListMultimap index( * keyFunction} produces {@code null} for any key * @since 10.0 */ - public static ImmutableListMultimap index( + public static ImmutableListMultimap index( Iterator values, Function keyFunction) { checkNotNull(keyFunction); - ImmutableListMultimap.Builder builder = ImmutableListMultimap.builder(); + ImmutableListMultimap.Builder builder = ImmutableListMultimap.builder(); while (values.hasNext()) { V value = values.next(); checkNotNull(value, values); @@ -1739,16 +1758,17 @@ public static ImmutableListMultimap index( return builder.build(); } - static class Keys + @ReceiverDependentMutable + static class Keys extends AbstractMultiset { @Weak final Multimap multimap; - Keys(Multimap multimap) { + Keys(@ReceiverDependentMutable Multimap multimap) { this.multimap = multimap; } @Override - Iterator> entryIterator() { + Iterator> entryIterator(@PolyMutable Keys this) { return new TransformedIterator>, Multiset.Entry>( multimap.asMap().entrySet().iterator()) { @Override @@ -1770,7 +1790,7 @@ public int getCount() { } @Override - public Spliterator spliterator() { + public Spliterator spliterator(@PolyMutable Keys this) { return CollectSpliterators.map(multimap.entries().spliterator(), Map.Entry::getKey); } @@ -1781,33 +1801,33 @@ public void forEach(Consumer consumer) { } @Override - int distinctElements() { + int distinctElements(@Readonly Keys this) { return multimap.asMap().size(); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly Keys this) { return multimap.size(); } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object element) { + public boolean contains(@Readonly Keys this, @CheckForNull @UnknownSignedness @Readonly Object element) { return multimap.containsKey(element); } @Override - public Iterator iterator() { + public Iterator iterator(@PolyMutable Keys this) { return Maps.keyIterator(multimap.entries().iterator()); } @Override - public @NonNegative int count(@CheckForNull @UnknownSignedness Object element) { + public @NonNegative int count(@Readonly Keys this, @CheckForNull @UnknownSignedness @Readonly Object element) { Collection values = Maps.safeGet(multimap.asMap(), element); return (values == null) ? 0 : values.size(); } @Override - public int remove(@CheckForNull Object element, int occurrences) { + public int remove(@Mutable Keys this, @CheckForNull @Readonly Object element, int occurrences) { checkNonnegative(occurrences, "occurrences"); if (occurrences == 0) { return count(element); @@ -1833,12 +1853,12 @@ public int remove(@CheckForNull Object element, int occurrences) { } @Override - public void clear() { + public void clear(@Mutable Keys this) { multimap.clear(); } @Override - public Set elementSet() { + public @PolyMutable Set elementSet(@PolyMutable Keys this) { return multimap.keySet(); } @@ -1849,17 +1869,18 @@ Iterator elementIterator() { } /** A skeleton implementation of {@link Multimap#entries()}. */ - abstract static class Entries - extends AbstractCollection> { - abstract Multimap multimap(); + @ReceiverDependentMutable + abstract static class Entries + extends AbstractCollection> { + abstract @PolyMutable Multimap multimap(@PolyMutable Entries this); @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly Entries this) { return multimap().size(); } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly Entries this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (o instanceof Map.Entry) { Map.Entry entry = (Map.Entry) o; return multimap().containsEntry(entry.getKey(), entry.getValue()); @@ -1868,7 +1889,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object o) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable Entries this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (o instanceof Map.Entry) { Map.Entry entry = (Map.Entry) o; return multimap().remove(entry.getKey(), entry.getValue()); @@ -1877,43 +1898,46 @@ public boolean remove(@CheckForNull @UnknownSignedness Object o) { } @Override - public void clear() { + public void clear(@Mutable Entries this) { multimap().clear(); } } /** A skeleton implementation of {@link Multimap#asMap()}. */ - static final class AsMap - extends Maps.ViewCachingAbstractMap> { + @ReceiverDependentMutable + static final class AsMap + extends Maps.ViewCachingAbstractMap> { @Weak private final Multimap multimap; - AsMap(Multimap multimap) { + AsMap(@ReceiverDependentMutable Multimap multimap) { this.multimap = checkNotNull(multimap); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly AsMap this) { return multimap.keySet().size(); } @Override - protected Set>> createEntrySet() { + protected @PolyMutable Set>> createEntrySet(@PolyMutable AsMap this) { return new EntrySet(); } - void removeValuesForKey(@CheckForNull Object key) { + void removeValuesForKey(@CheckForNull @Readonly Object key) { multimap.keySet().remove(key); } @WeakOuter - class EntrySet extends Maps.EntrySet> { + @ReceiverDependentMutable + @CFComment("PICO: outer receiver dependency") + class EntrySet extends Maps.EntrySet> { @Override - Map> map() { + @PolyMutable Map> map(@PolyMutable AsMap.@Readonly EntrySet this) { return AsMap.this; } @Override - public Iterator>> iterator() { + public Iterator<@PolyMutable Entry>> iterator(@PolyMutable AsMap.@Readonly EntrySet this) { return Maps.asMapEntryIterator( multimap.keySet(), new Function>() { @@ -1925,7 +1949,7 @@ public Collection apply(@ParametricNullness K key) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable EntrySet this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (!contains(o)) { return false; } @@ -1939,33 +1963,33 @@ public boolean remove(@CheckForNull @UnknownSignedness Object o) { @SuppressWarnings("unchecked") @Override @CheckForNull - public Collection get(@CheckForNull @UnknownSignedness Object key) { + public @PolyMutable Collection get(@PolyMutable AsMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return containsKey(key) ? multimap.get((K) key) : null; } @Override @CheckForNull - public Collection remove(@CheckForNull @UnknownSignedness Object key) { + public @Readonly Collection remove(@Mutable AsMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return containsKey(key) ? multimap.removeAll(key) : null; } @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable AsMap this) { return multimap.keySet(); } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly AsMap this) { return multimap.isEmpty(); } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Mutable AsMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { return multimap.containsKey(key); } @Override - public void clear() { + public void clear(@Mutable AsMap this) { multimap.clear(); } } @@ -1997,7 +2021,7 @@ public void clear() { * * @since 11.0 */ - public static Multimap filterKeys( + public static Multimap filterKeys( Multimap unfiltered, final Predicate keyPredicate) { if (unfiltered instanceof SetMultimap) { return filterKeys((SetMultimap) unfiltered, keyPredicate); @@ -2042,7 +2066,7 @@ public void clear() { * * @since 14.0 */ - public static + public static SetMultimap filterKeys( SetMultimap unfiltered, final Predicate keyPredicate) { if (unfiltered instanceof FilteredKeySetMultimap) { @@ -2084,7 +2108,7 @@ SetMultimap filterKeys( * * @since 14.0 */ - public static + public static ListMultimap filterKeys( ListMultimap unfiltered, final Predicate keyPredicate) { if (unfiltered instanceof FilteredKeyListMultimap) { @@ -2123,7 +2147,7 @@ ListMultimap filterKeys( * * @since 11.0 */ - public static + public static Multimap filterValues( Multimap unfiltered, final Predicate valuePredicate) { return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate)); @@ -2156,7 +2180,7 @@ Multimap filterValues( * * @since 14.0 */ - public static + public static SetMultimap filterValues( SetMultimap unfiltered, final Predicate valuePredicate) { return filterEntries(unfiltered, Maps.valuePredicateOnEntries(valuePredicate)); @@ -2187,7 +2211,7 @@ SetMultimap filterValues( * * @since 11.0 */ - public static + public static Multimap filterEntries( Multimap unfiltered, Predicate> entryPredicate) { checkNotNull(entryPredicate); @@ -2224,7 +2248,7 @@ Multimap filterEntries( * * @since 14.0 */ - public static + public static SetMultimap filterEntries( SetMultimap unfiltered, Predicate> entryPredicate) { checkNotNull(entryPredicate); @@ -2239,7 +2263,7 @@ SetMultimap filterEntries( * lead to a multimap whose removal operations would fail. This method combines the predicates to * avoid that problem. */ - private static + private static Multimap filterFiltered( FilteredMultimap multimap, Predicate> entryPredicate) { Predicate> predicate = @@ -2253,7 +2277,7 @@ Multimap filterFiltered( * lead to a multimap whose removal operations would fail. This method combines the predicates to * avoid that problem. */ - private static + private static SetMultimap filterFiltered( FilteredSetMultimap multimap, Predicate> entryPredicate) { Predicate> predicate = @@ -2261,7 +2285,7 @@ SetMultimap filterFiltered( return new FilteredEntrySetMultimap<>(multimap.unfiltered(), predicate); } - static boolean equalsImpl(Multimap multimap, @CheckForNull @UnknownSignedness Object object) { + static boolean equalsImpl(@Readonly Multimap multimap, @CheckForNull @UnknownSignedness @Readonly Object object) { if (object == multimap) { return true; } diff --git a/guava/src/com/google/common/collect/Multiset.java b/guava/src/com/google/common/collect/Multiset.java index cfa3adf164a4..c7e6433f1198 100644 --- a/guava/src/com/google/common/collect/Multiset.java +++ b/guava/src/com/google/common/collect/Multiset.java @@ -33,6 +33,10 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -90,10 +94,11 @@ * @author Kevin Bourrillion * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public interface Multiset extends Collection { +@ReceiverDependentMutable +public interface Multiset extends Collection { // Query Operations /** @@ -103,7 +108,7 @@ public interface Multiset extends Collection { * multiset, which is given by {@code entrySet().size()}. */ @Override - @NonNegative int size(); + @NonNegative int size(@Readonly Multiset this); /** * Returns the number of occurrences of an element in this multiset (the count of the @@ -118,7 +123,7 @@ public interface Multiset extends Collection { * @return the number of occurrences of the element in this multiset; possibly zero but never * negative */ - int count(@CompatibleWith("E") @CheckForNull Object element); + int count(@Readonly Multiset this, @CompatibleWith("E") @CheckForNull @Readonly Object element); // Bulk Operations @@ -141,7 +146,7 @@ public interface Multiset extends Collection { * return normally. */ @CanIgnoreReturnValue - int add(@ParametricNullness E element, int occurrences); + int add(@Mutable Multiset this, @ParametricNullness E element, int occurrences); /** * Adds a single occurrence of the specified element to this multiset. @@ -164,7 +169,7 @@ public interface Multiset extends Collection { */ @CanIgnoreReturnValue @Override - boolean add(@ParametricNullness E element); + boolean add(@Mutable Multiset this, @ParametricNullness E element); /** * Removes a number of occurrences of the specified element from this multiset. If the multiset @@ -179,7 +184,7 @@ public interface Multiset extends Collection { * @throws IllegalArgumentException if {@code occurrences} is negative */ @CanIgnoreReturnValue - int remove(@CompatibleWith("E") @CheckForNull Object element, int occurrences); + int remove(@Mutable Multiset this, @CompatibleWith("E") @CheckForNull @Readonly Object element, int occurrences); /** * Removes a single occurrence of the specified element from this multiset, if present. @@ -195,7 +200,7 @@ public interface Multiset extends Collection { */ @CanIgnoreReturnValue @Override - boolean remove(@CheckForNull @UnknownSignedness Object element); + boolean remove(@Mutable Multiset this, @CheckForNull @UnknownSignedness @Readonly Object element); /** * Adds or removes the necessary occurrences of an element such that the element attains the @@ -211,7 +216,7 @@ public interface Multiset extends Collection { * zero instead. */ @CanIgnoreReturnValue - int setCount(@ParametricNullness E element, int count); + int setCount(@Mutable Multiset this, @ParametricNullness E element, int count); /** * Conditionally sets the count of an element to a new value, as described in {@link @@ -230,7 +235,7 @@ public interface Multiset extends Collection { * implementor may optionally return {@code true} instead. */ @CanIgnoreReturnValue - boolean setCount(@ParametricNullness E element, int oldCount, int newCount); + boolean setCount(@Mutable Multiset this, @ParametricNullness E element, int oldCount, int newCount); // Views @@ -248,7 +253,7 @@ public interface Multiset extends Collection { * * @return a view of the set of distinct elements in this multiset */ - Set elementSet(); + @PolyMutable Set elementSet(@PolyMutable Multiset this); /** * Returns a view of the contents of this multiset, grouped into {@code Multiset.Entry} instances, @@ -266,7 +271,7 @@ public interface Multiset extends Collection { * * @return a set of entries representing the data of this multiset */ - Set> entrySet(); + @PolyMutable Set> entrySet(@PolyMutable Multiset this); /** * An unmodifiable element-count pair for a multiset. The {@link Multiset#entrySet} method returns @@ -276,7 +281,8 @@ public interface Multiset extends Collection { * * @since 2.0 */ - interface Entry { + @ReceiverDependentMutable + interface Entry { /** * Returns the multiset element corresponding to this entry. Multiple calls to this method @@ -285,7 +291,7 @@ interface Entry { * @return the element corresponding to this entry */ @ParametricNullness - E getElement(); + E getElement(@Readonly Entry this); /** * Returns the count of the associated element in the underlying multiset. This count may either @@ -296,7 +302,7 @@ interface Entry { * * @return the count of the element; never negative */ - int getCount(); + int getCount(@Readonly Entry this); /** * {@inheritDoc} @@ -313,7 +319,7 @@ interface Entry { @Pure @Override // TODO(kevinb): check this wrt TreeMultiset? - boolean equals(@CheckForNull Object o); + boolean equals(@Readonly Entry this, @CheckForNull @Readonly Object o); /** * {@inheritDoc} @@ -327,7 +333,7 @@ interface Entry { */ @Pure @Override - int hashCode(@UnknownSignedness Entry this); + int hashCode(@UnknownSignedness @Readonly Entry this); /** * Returns the canonical string representation of this entry, defined as follows. If the count @@ -337,7 +343,7 @@ interface Entry { */ @SideEffectFree @Override - String toString(); + String toString(@Readonly Entry this); } /** @@ -364,7 +370,7 @@ default void forEachEntry(ObjIntConsumer action) { @Pure @Override // TODO(kevinb): caveats about equivalence-relation? - boolean equals(@CheckForNull @UnknownSignedness Object object); + boolean equals(@Readonly Multiset this, @CheckForNull @UnknownSignedness @Readonly Object object); /** * Returns the hash code for this multiset. This is defined as the sum of @@ -378,7 +384,7 @@ default void forEachEntry(ObjIntConsumer action) { */ @Pure @Override - int hashCode(@UnknownSignedness Multiset this); + int hashCode(@UnknownSignedness @Readonly Multiset this); /** * {@inheritDoc} @@ -389,7 +395,7 @@ default void forEachEntry(ObjIntConsumer action) { */ @SideEffectFree @Override - String toString(); + String toString(@Readonly Multiset this); // Refined Collection Methods @@ -400,7 +406,7 @@ default void forEachEntry(ObjIntConsumer action) { * iterator, though not necessarily sequentially. */ @Override - Iterator iterator(); + Iterator iterator(@Readonly Multiset this); /** * Determines whether this multiset contains the specified element. @@ -413,7 +419,7 @@ default void forEachEntry(ObjIntConsumer action) { */ @Pure @Override - boolean contains(@CheckForNull @UnknownSignedness Object element); + boolean contains(@Readonly Multiset this, @CheckForNull @UnknownSignedness @Readonly Object element); /** * Returns {@code true} if this multiset contains at least one occurrence of each element in the @@ -434,7 +440,7 @@ default void forEachEntry(ObjIntConsumer action) { */ @Pure @Override - boolean containsAll(Collection elements); + boolean containsAll(@Readonly Multiset this, @Readonly Collection elements); /** * {@inheritDoc} @@ -449,7 +455,7 @@ default void forEachEntry(ObjIntConsumer action) { */ @CanIgnoreReturnValue @Override - boolean removeAll(Collection c); + boolean removeAll(@Mutable Multiset this, @Readonly Collection c); /** * {@inheritDoc} @@ -466,7 +472,7 @@ default void forEachEntry(ObjIntConsumer action) { */ @CanIgnoreReturnValue @Override - boolean retainAll(Collection c); + boolean retainAll(@Mutable Multiset this, @Readonly Collection c); /** * {@inheritDoc} @@ -489,7 +495,7 @@ default void forEach(Consumer action) { } @Override - default Spliterator spliterator() { + default Spliterator spliterator(@Readonly Multiset this) { return Multisets.spliteratorImpl(this); } } diff --git a/guava/src/com/google/common/collect/Multisets.java b/guava/src/com/google/common/collect/Multisets.java index c6a46509dbe3..7169540a0a0b 100644 --- a/guava/src/com/google/common/collect/Multisets.java +++ b/guava/src/com/google/common/collect/Multisets.java @@ -47,10 +47,17 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * Provides static utility methods for creating and working with {@link Multiset} instances. @@ -64,7 +71,7 @@ * @author Louis Wasserman * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault public final class Multisets { @@ -87,7 +94,7 @@ private Multisets() {} * * @since 22.0 */ - public static > + public static > Collector toMultiset( Function elementFunction, ToIntFunction countFunction, @@ -105,7 +112,7 @@ private Multisets() {} * @param multiset the multiset for which an unmodifiable view is to be generated * @return an unmodifiable view of the multiset */ - public static Multiset unmodifiableMultiset( + public static @Readonly Multiset unmodifiableMultiset( Multiset multiset) { if (multiset instanceof UnmodifiableMultiset || multiset instanceof ImmutableMultiset) { @SuppressWarnings("unchecked") // Since it's unmodifiable, the covariant cast is safe @@ -126,22 +133,24 @@ public static Multiset unmodifiableMultiset(ImmutableMultiset multiset return checkNotNull(multiset); } - static class UnmodifiableMultiset extends ForwardingMultiset + @Immutable + static class UnmodifiableMultiset extends ForwardingMultiset implements Serializable { - final Multiset delegate; + final @Readonly Multiset delegate; - UnmodifiableMultiset(Multiset delegate) { + UnmodifiableMultiset(@Readonly Multiset delegate) { this.delegate = delegate; } @SuppressWarnings("unchecked") @Override - protected Multiset delegate() { + protected @Readonly Multiset delegate() { // This is safe because all non-covariant methods are overridden return (Multiset) delegate; } - @CheckForNull transient Set elementSet; + @CFComment("Change to @LazyFinal later") + @CheckForNull transient @Assignable Set elementSet; Set createElementSet() { return Collections.unmodifiableSet(delegate.elementSet()); @@ -149,17 +158,18 @@ Set createElementSet() { @SideEffectFree @Override - public Set elementSet() { + public @PolyMutable Set elementSet(@PolyMutable UnmodifiableMultiset this) { Set es = elementSet; return (es == null) ? elementSet = createElementSet() : es; } - @CheckForNull transient Set> entrySet; + @CFComment("Change to @LazyFinal later") + @CheckForNull transient @Assignable Set> entrySet; @SideEffectFree @SuppressWarnings("unchecked") @Override - public Set> entrySet() { + public @PolyMutable Set> entrySet(@PolyMutable UnmodifiableMultiset this) { Set> es = entrySet; return (es == null) // Safe because the returned set is made unmodifiable and Entry @@ -169,7 +179,7 @@ public Set> entrySet() { } @Override - public Iterator iterator() { + public @Readonly Iterator iterator() { return Iterators.unmodifiableIterator(delegate.iterator()); } @@ -189,22 +199,22 @@ public boolean addAll(Collection elementsToAdd) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object element) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object element) { throw new UnsupportedOperationException(); } @Override - public int remove(@CheckForNull Object element, int occurrences) { + public int remove(@CheckForNull @Readonly Object element, int occurrences) { throw new UnsupportedOperationException(); } @Override - public boolean removeAll(Collection elementsToRemove) { + public boolean removeAll(@Readonly Collection elementsToRemove) { throw new UnsupportedOperationException(); } @Override - public boolean retainAll(Collection elementsToRetain) { + public boolean retainAll(@Readonly Collection elementsToRetain) { throw new UnsupportedOperationException(); } @@ -238,7 +248,7 @@ public boolean setCount(@ParametricNullness E element, int oldCount, int newCoun * @since 11.0 */ @Beta - public static SortedMultiset unmodifiableSortedMultiset( + public static @Readonly SortedMultiset unmodifiableSortedMultiset( SortedMultiset sortedMultiset) { // it's in its own file so it can be emulated for GWT return new UnmodifiableSortedMultiset(checkNotNull(sortedMultiset)); @@ -252,12 +262,13 @@ public boolean setCount(@ParametricNullness E element, int oldCount, int newCoun * @param n the count to be associated with the returned entry * @throws IllegalArgumentException if {@code n} is negative */ - public static Multiset.Entry immutableEntry( + public static Multiset.@Immutable Entry immutableEntry( @ParametricNullness E e, int n) { return new ImmutableEntry(e, n); } - static class ImmutableEntry extends AbstractEntry + @Immutable + static class ImmutableEntry extends AbstractEntry implements Serializable { @ParametricNullness private final E element; private final int count; @@ -313,7 +324,7 @@ public ImmutableEntry nextInBucket() { * @since 14.0 */ @Beta - public static Multiset filter( + public static Multiset filter( Multiset unfiltered, Predicate predicate) { if (unfiltered instanceof FilteredMultiset) { // Support clear(), removeAll(), and retainAll() when filtering a filtered @@ -325,17 +336,18 @@ public ImmutableEntry nextInBucket() { return new FilteredMultiset(unfiltered, predicate); } - private static final class FilteredMultiset extends ViewMultiset { + @ReceiverDependentMutable + private static final class FilteredMultiset extends ViewMultiset { final Multiset unfiltered; final Predicate predicate; - FilteredMultiset(Multiset unfiltered, Predicate predicate) { + FilteredMultiset(@ReceiverDependentMutable Multiset unfiltered, Predicate predicate) { this.unfiltered = checkNotNull(unfiltered); this.predicate = checkNotNull(predicate); } @Override - public UnmodifiableIterator iterator() { + public @Readonly UnmodifiableIterator iterator(@Readonly FilteredMultiset this) { return Iterators.filter(unfiltered.iterator(), predicate); } @@ -367,7 +379,7 @@ Iterator> entryIterator() { } @Override - public @NonNegative int count(@CheckForNull @UnknownSignedness Object element) { + public @NonNegative int count(@CheckForNull @UnknownSignedness @Readonly Object element) { int count = unfiltered.count(element); if (count > 0) { @SuppressWarnings("unchecked") // element is equal to an E @@ -385,7 +397,7 @@ public int add(@ParametricNullness E element, int occurrences) { } @Override - public int remove(@CheckForNull Object element, int occurrences) { + public int remove(@CheckForNull @Readonly Object element, int occurrences) { checkNonnegative(occurrences, "occurrences"); if (occurrences == 0) { return count(element); @@ -420,7 +432,7 @@ static int inferDistinctElements(Iterable elements) { * @since 14.0 */ @Beta - public static Multiset union( + public static Multiset union( final Multiset multiset1, final Multiset multiset2) { checkNotNull(multiset1); checkNotNull(multiset2); @@ -492,7 +504,7 @@ protected Entry computeNext() { * * @since 2.0 */ - public static Multiset intersection( + public static Multiset intersection( final Multiset multiset1, final Multiset multiset2) { checkNotNull(multiset1); checkNotNull(multiset2); @@ -550,7 +562,7 @@ protected Entry computeNext() { * @since 14.0 */ @Beta - public static Multiset sum( + public static Multiset sum( final Multiset multiset1, final Multiset multiset2) { checkNotNull(multiset1); checkNotNull(multiset2); @@ -628,7 +640,7 @@ protected Entry computeNext() { * @since 14.0 */ @Beta - public static Multiset difference( + public static Multiset difference( final Multiset multiset1, final Multiset multiset2) { checkNotNull(multiset1); checkNotNull(multiset2); @@ -734,7 +746,7 @@ public static boolean retainOccurrences( } /** Delegate implementation which cares about the element type. */ - private static boolean retainOccurrencesImpl( + private static boolean retainOccurrencesImpl( Multiset multisetToModify, Multiset occurrencesToRetain) { checkNotNull(multisetToModify); checkNotNull(occurrencesToRetain); @@ -818,7 +830,7 @@ public static boolean removeOccurrences( */ @CanIgnoreReturnValue public static boolean removeOccurrences( - Multiset multisetToModify, Multiset occurrencesToRemove) { + @Mutable Multiset multisetToModify, Multiset occurrencesToRemove) { checkNotNull(multisetToModify); checkNotNull(occurrencesToRemove); @@ -842,14 +854,15 @@ public static boolean removeOccurrences( * Implementation of the {@code equals}, {@code hashCode}, and {@code toString} methods of {@link * Multiset.Entry}. */ - abstract static class AbstractEntry implements Multiset.Entry { + @ReceiverDependentMutable + abstract static class AbstractEntry implements Multiset.Entry { /** * Indicates whether an object equals this entry, following the behavior specified in {@link * Multiset.Entry#equals}. */ @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@Readonly AbstractEntry this, @CheckForNull @Readonly Object object) { if (object instanceof Multiset.Entry) { Multiset.Entry that = (Multiset.Entry) object; return this.getCount() == that.getCount() @@ -864,7 +877,7 @@ public boolean equals(@CheckForNull Object object) { */ @Pure @Override - public int hashCode(@UnknownSignedness AbstractEntry this) { + public int hashCode(@UnknownSignedness @Readonly AbstractEntry this) { E e = getElement(); return ((e == null) ? 0 : e.hashCode()) ^ getCount(); } @@ -877,7 +890,7 @@ public int hashCode(@UnknownSignedness AbstractEntry this) { */ @Pure @Override - public String toString() { + public String toString(@Readonly AbstractEntry this) { String text = String.valueOf(getElement()); int n = getCount(); return (n == 1) ? text : (text + " x " + n); @@ -885,7 +898,7 @@ public String toString() { } /** An implementation of {@link Multiset#equals}. */ - static boolean equalsImpl(Multiset multiset, @CheckForNull @UnknownSignedness Object object) { + static boolean equalsImpl(@Readonly Multiset multiset, @CheckForNull @UnknownSignedness @Readonly Object object) { if (object == multiset) { return true; } @@ -911,8 +924,7 @@ static boolean equalsImpl(Multiset multiset, @CheckForNull @UnknownSignedness } /** An implementation of {@link Multiset#addAll}. */ - static boolean addAllImpl( - Multiset self, Collection elements) { + static boolean addAllImpl(Multiset self, @Readonly Collection elements) { checkNotNull(self); checkNotNull(elements); if (elements instanceof Multiset) { @@ -925,8 +937,7 @@ static boolean equalsImpl(Multiset multiset, @CheckForNull @UnknownSignedness } /** A specialization of {@code addAllImpl} for when {@code elements} is itself a Multiset. */ - private static boolean addAllImpl( - Multiset self, Multiset elements) { + private static boolean addAllImpl(Multiset self, @Readonly Multiset elements) { if (elements.isEmpty()) { return false; } @@ -935,7 +946,7 @@ static boolean equalsImpl(Multiset multiset, @CheckForNull @UnknownSignedness } /** An implementation of {@link Multiset#removeAll}. */ - static boolean removeAllImpl(Multiset self, Collection elementsToRemove) { + static boolean removeAllImpl(Multiset self, @Readonly Collection elementsToRemove) { Collection collection = (elementsToRemove instanceof Multiset) ? ((Multiset) elementsToRemove).elementSet() @@ -945,7 +956,7 @@ static boolean removeAllImpl(Multiset self, Collection elementsToRemove) { } /** An implementation of {@link Multiset#retainAll}. */ - static boolean retainAllImpl(Multiset self, Collection elementsToRetain) { + static boolean retainAllImpl(Multiset self, @Readonly Collection elementsToRetain) { checkNotNull(elementsToRetain); Collection collection = (elementsToRetain instanceof Multiset) @@ -956,8 +967,7 @@ static boolean retainAllImpl(Multiset self, Collection elementsToRetain) { } /** An implementation of {@link Multiset#setCount(Object, int)}. */ - static int setCountImpl( - Multiset self, @ParametricNullness E element, int count) { + static int setCountImpl(Multiset self, @ParametricNullness E element, int count) { checkNonnegative(count, "count"); int oldCount = self.count(element); @@ -973,8 +983,7 @@ static boolean retainAllImpl(Multiset self, Collection elementsToRetain) { } /** An implementation of {@link Multiset#setCount(Object, int, int)}. */ - static boolean setCountImpl( - Multiset self, @ParametricNullness E element, int oldCount, int newCount) { + static boolean setCountImpl(Multiset self, @ParametricNullness E element, int oldCount, int newCount) { checkNonnegative(oldCount, "oldCount"); checkNonnegative(newCount, "newCount"); @@ -986,7 +995,7 @@ static boolean retainAllImpl(Multiset self, Collection elementsToRetain) { } } - static Iterator elementIterator( + static Iterator elementIterator( Iterator> entryIterator) { return new TransformedIterator, E>(entryIterator) { @Override @@ -997,49 +1006,51 @@ E transform(Entry entry) { }; } - abstract static class ElementSet extends Sets.ImprovedAbstractSet { + @ReceiverDependentMutable + abstract static class ElementSet extends Sets.ImprovedAbstractSet { abstract Multiset multiset(); @Override - public void clear() { + public void clear(@Mutable ElementSet this) { multiset().clear(); } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly ElementSet this, @CheckForNull @UnknownSignedness @Readonly Object o) { return multiset().contains(o); } @Override - public boolean containsAll(Collection c) { + public boolean containsAll(@Readonly ElementSet this, @Readonly Collection c) { return multiset().containsAll(c); } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly ElementSet this) { return multiset().isEmpty(); } @Override - public abstract Iterator iterator(); + public abstract Iterator iterator(@Readonly ElementSet this); @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable ElementSet this, @CheckForNull @UnknownSignedness @Readonly Object o) { return multiset().remove(o, Integer.MAX_VALUE) > 0; } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly ElementSet this) { return multiset().entrySet().size(); } } - abstract static class EntrySet + @ReceiverDependentMutable + abstract static class EntrySet extends Sets.ImprovedAbstractSet> { abstract Multiset multiset(); @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly EntrySet this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (o instanceof Entry) { /* * The GWT compiler wrongly issues a warning here. @@ -1058,7 +1069,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object o) { // GWT compiler warning; see contains(). @SuppressWarnings("cast") @Override - public boolean remove(@CheckForNull @UnknownSignedness Object object) { + public boolean remove(@Mutable EntrySet this, @CheckForNull @UnknownSignedness @Readonly Object object) { if (object instanceof Multiset.Entry) { Entry entry = (Entry) object; Object element = entry.getElement(); @@ -1075,19 +1086,20 @@ public boolean remove(@CheckForNull @UnknownSignedness Object object) { } @Override - public void clear() { + public void clear(@Mutable EntrySet this) { multiset().clear(); } } /** An implementation of {@link Multiset#iterator}. */ - static Iterator iteratorImpl(Multiset multiset) { + static Iterator iteratorImpl(@Readonly Multiset multiset) { return new MultisetIteratorImpl(multiset, multiset.entrySet().iterator()); } - static final class MultisetIteratorImpl implements Iterator { + @ReceiverDependentMutable + static final class MultisetIteratorImpl implements Iterator { private final Multiset multiset; - private final Iterator> entryIterator; + private final Iterator<@Readonly Entry> entryIterator; @CheckForNull private Entry currentEntry; /** Count of subsequent elements equal to current element */ @@ -1098,19 +1110,19 @@ static final class MultisetIteratorImpl implements I private boolean canRemove; - MultisetIteratorImpl(Multiset multiset, Iterator> entryIterator) { + MultisetIteratorImpl(@ReceiverDependentMutable Multiset multiset, @ReceiverDependentMutable Iterator<@Readonly Entry> entryIterator) { this.multiset = multiset; this.entryIterator = entryIterator; } @Override - public boolean hasNext() { + public boolean hasNext(@Readonly MultisetIteratorImpl this) { return laterCount > 0 || entryIterator.hasNext(); } @Override @ParametricNullness - public E next() { + public E next(@Mutable MultisetIteratorImpl this) { if (!hasNext()) { throw new NoSuchElementException(); } @@ -1128,7 +1140,7 @@ public E next() { } @Override - public void remove() { + public void remove(@Mutable MultisetIteratorImpl this) { checkRemove(canRemove); if (totalCount == 1) { entryIterator.remove(); @@ -1144,7 +1156,7 @@ public void remove() { } } - static Spliterator spliteratorImpl(Multiset multiset) { + static Spliterator spliteratorImpl(Multiset multiset) { Spliterator> entrySpliterator = multiset.entrySet().spliterator(); return CollectSpliterators.flatMap( entrySpliterator, @@ -1156,7 +1168,7 @@ public void remove() { } /** An implementation of {@link Multiset#size}. */ - static int linearTimeSizeImpl(Multiset multiset) { + static int linearTimeSizeImpl(@Readonly Multiset multiset) { long size = 0; for (Entry entry : multiset.entrySet()) { size += entry.getCount(); @@ -1165,7 +1177,7 @@ static int linearTimeSizeImpl(Multiset multiset) { } /** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */ - static Multiset cast(Iterable iterable) { + static Multiset cast(Iterable iterable) { return (Multiset) iterable; } @@ -1182,6 +1194,7 @@ public static ImmutableMultiset copyHighestCountFirst(Multiset multise return ImmutableMultiset.copyFromEntries(Arrays.asList(entries)); } + @Immutable private static final class DecreasingCount implements Comparator> { static final DecreasingCount INSTANCE = new DecreasingCount(); @@ -1195,25 +1208,26 @@ public int compare(Entry entry1, Entry entry2) { * An {@link AbstractMultiset} with additional default implementations, some of them linear-time * implementations in terms of {@code elementSet} and {@code entrySet}. */ - private abstract static class ViewMultiset + @ReceiverDependentMutable + private abstract static class ViewMultiset extends AbstractMultiset { @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly ViewMultiset this) { return linearTimeSizeImpl(this); } @Override - public void clear() { + public void clear(@Mutable ViewMultiset this) { elementSet().clear(); } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly ViewMultiset this) { return iteratorImpl(this); } @Override - int distinctElements() { + int distinctElements(@Readonly ViewMultiset this) { return elementSet().size(); } } diff --git a/guava/src/com/google/common/collect/NaturalOrdering.java b/guava/src/com/google/common/collect/NaturalOrdering.java index 20af68fae52f..0f3503a89a38 100644 --- a/guava/src/com/google/common/collect/NaturalOrdering.java +++ b/guava/src/com/google/common/collect/NaturalOrdering.java @@ -23,48 +23,49 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; /** An ordering that uses the natural order of the values. */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true) @SuppressWarnings({"unchecked", "rawtypes"}) // TODO(kevinb): the right way to explain this?? @ElementTypesAreNonnullByDefault -final class NaturalOrdering extends Ordering> implements Serializable { +final class NaturalOrdering extends Ordering<@Readonly Comparable> implements Serializable { static final NaturalOrdering INSTANCE = new NaturalOrdering(); - @CheckForNull private transient Ordering<@Nullable Comparable> nullsFirst; - @CheckForNull private transient Ordering<@Nullable Comparable> nullsLast; + @CheckForNull private transient Ordering<@Nullable @Readonly Comparable> nullsFirst; + @CheckForNull private transient Ordering<@Nullable @Readonly Comparable> nullsLast; @Pure @Override - public int compare(Comparable left, Comparable right) { + public int compare(@Readonly Comparable left, @Readonly Comparable right) { checkNotNull(left); // for GWT checkNotNull(right); - return ((Comparable) left).compareTo(right); + return ((Comparable<@Readonly Object>) left).compareTo(right); } @Override - public > Ordering<@Nullable S> nullsFirst() { - Ordering<@Nullable Comparable> result = nullsFirst; + public > Ordering<@Nullable S> nullsFirst() { + Ordering<@Nullable @Readonly Comparable> result = nullsFirst; if (result == null) { - result = nullsFirst = super.>nullsFirst(); + result = nullsFirst = super.<@Readonly Comparable>nullsFirst(); } return (Ordering<@Nullable S>) result; } @Override - public > Ordering<@Nullable S> nullsLast() { - Ordering<@Nullable Comparable> result = nullsLast; + public > Ordering<@Nullable S> nullsLast() { + Ordering<@Nullable @Readonly Comparable> result = nullsLast; if (result == null) { - result = nullsLast = super.>nullsLast(); + result = nullsLast = super.<@Readonly Comparable>nullsLast(); } return (Ordering<@Nullable S>) result; } @Override - public > Ordering reverse() { + public > Ordering reverse() { return (Ordering) ReverseNaturalOrdering.INSTANCE; } diff --git a/guava/src/com/google/common/collect/NullnessCasts.java b/guava/src/com/google/common/collect/NullnessCasts.java index 4f894dbd3139..03f628fabac9 100644 --- a/guava/src/com/google/common/collect/NullnessCasts.java +++ b/guava/src/com/google/common/collect/NullnessCasts.java @@ -17,6 +17,7 @@ import com.google.common.annotations.GwtCompatible; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; /** A utility method to perform unchecked casts to suppress errors produced by nullness analyses. */ @GwtCompatible @@ -52,7 +53,7 @@ final class NullnessCasts { */ @ParametricNullness @SuppressWarnings("nullness") - static T uncheckedCastNullableTToT(@CheckForNull T t) { + static T uncheckedCastNullableTToT(@CheckForNull T t) { return t; } @@ -60,7 +61,7 @@ final class NullnessCasts { @SuppressWarnings({"nullness", "TypeParameterUnusedInFormals", "ReturnMissingNullable"}) // The warnings are legitimate. Each time we use this method, we document why. @ParametricNullness - static T unsafeNull() { + static T unsafeNull() { return null; } diff --git a/guava/src/com/google/common/collect/NullsFirstOrdering.java b/guava/src/com/google/common/collect/NullsFirstOrdering.java index 52e968a8fd13..4b2d387f22a1 100644 --- a/guava/src/com/google/common/collect/NullsFirstOrdering.java +++ b/guava/src/com/google/common/collect/NullsFirstOrdering.java @@ -20,15 +20,16 @@ import java.io.Serializable; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; /** An ordering that treats {@code null} as less than all other values. */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -final class NullsFirstOrdering extends Ordering<@Nullable T> +final class NullsFirstOrdering extends Ordering<@Nullable T> implements Serializable { final Ordering ordering; @@ -71,7 +72,7 @@ public int compare(@CheckForNull T left, @CheckForNull T right) { @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@CheckForNull @Readonly Object object) { if (object == this) { return true; } diff --git a/guava/src/com/google/common/collect/NullsLastOrdering.java b/guava/src/com/google/common/collect/NullsLastOrdering.java index d2f3cce7220f..c08df897f577 100644 --- a/guava/src/com/google/common/collect/NullsLastOrdering.java +++ b/guava/src/com/google/common/collect/NullsLastOrdering.java @@ -20,15 +20,16 @@ import java.io.Serializable; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; /** An ordering that treats {@code null} as greater than all other values. */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -final class NullsLastOrdering extends Ordering<@Nullable T> +final class NullsLastOrdering extends Ordering<@Nullable T> implements Serializable { final Ordering ordering; @@ -71,7 +72,7 @@ public int compare(@CheckForNull T left, @CheckForNull T right) { @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@CheckForNull @Readonly Object object) { if (object == this) { return true; } diff --git a/guava/src/com/google/common/collect/ObjectArrays.java b/guava/src/com/google/common/collect/ObjectArrays.java index bf5b40fcb717..8edcef0ba35b 100644 --- a/guava/src/com/google/common/collect/ObjectArrays.java +++ b/guava/src/com/google/common/collect/ObjectArrays.java @@ -25,6 +25,8 @@ import java.util.Arrays; import java.util.Collection; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.framework.qual.AnnotatedFor; @@ -59,7 +61,7 @@ public static T[] newArray(Class type, int length) { * @param reference any array of the desired type * @param length the length of the new array */ - public static T[] newArray(T[] reference, int length) { + public static T @Mutable [] newArray(T @Readonly [] reference, int length) { return Platform.newArray(reference, length); } @@ -86,7 +88,7 @@ public static T[] concat(T[] first, T[] second, Class type) { * @return an array whose size is one larger than {@code array}, with {@code element} occupying * the first position, and the elements of {@code array} occupying the remaining elements. */ - public static T[] concat(@ParametricNullness T element, T[] array) { + public static T[] concat(@ParametricNullness T element, T[] array) { T[] result = newArray(array, array.length + 1); result[0] = element; System.arraycopy(array, 0, result, 1, array.length); @@ -101,7 +103,7 @@ public static T[] concat(T[] first, T[] second, Class type) { * @return an array whose size is one larger than {@code array}, with the same contents as {@code * array}, plus {@code element} occupying the last position. */ - public static T[] concat(T[] array, @ParametricNullness T element) { + public static T[] concat(T[] array, @ParametricNullness T element) { T[] result = Arrays.copyOf(array, array.length + 1); result[array.length] = element; return result; @@ -128,7 +130,7 @@ public static T[] concat(T[] first, T[] second, Class type) { * @throws ArrayStoreException if the runtime type of the specified array is not a supertype of * the runtime type of every element in the specified collection */ - static T[] toArrayImpl(Collection c, T[] array) { + static T @Mutable [] toArrayImpl(@Readonly Collection c, T @Readonly [] array) { int size = c.size(); if (array.length < size) { array = newArray(array, size); @@ -152,7 +154,7 @@ public static T[] concat(T[] first, T[] second, Class type) { * collection is set to {@code null}. This is useful in determining the length of the collection * only if the caller knows that the collection does not contain any null elements. */ - static T[] toArrayImpl( + static T[] toArrayImpl( @Nullable Object[] src, int offset, int len, T[] dst) { checkPositionIndexes(offset, offset + len, src.length); if (dst.length < len) { @@ -196,7 +198,7 @@ public static T[] concat(T[] first, T[] second, Class type) { } @CanIgnoreReturnValue - private static @Nullable Object[] fillArray(Iterable elements, @Nullable Object[] array) { + private static @Nullable Object [] fillArray(Iterable elements, @Nullable Object [] array) { int i = 0; for (Object element : elements) { array[i++] = element; @@ -205,19 +207,19 @@ public static T[] concat(T[] first, T[] second, Class type) { } /** Swaps {@code array[i]} with {@code array[j]}. */ - static void swap(Object[] array, int i, int j) { + static void swap(@Readonly Object @Mutable [] array, int i, int j) { Object temp = array[i]; array[i] = array[j]; array[j] = temp; } @CanIgnoreReturnValue - static @PolySigned Object[] checkElementsNotNull(@PolySigned Object... array) { + static @PolySigned Object[] checkElementsNotNull(@PolySigned @Readonly Object @Readonly ... array) { return checkElementsNotNull(array, array.length); } @CanIgnoreReturnValue - static @PolySigned Object[] checkElementsNotNull(@PolySigned Object[] array, int length) { + static @PolySigned Object[] checkElementsNotNull(@PolySigned @Readonly Object @Readonly [] array, int length) { for (int i = 0; i < length; i++) { checkElementNotNull(array[i], i); } @@ -227,7 +229,7 @@ static void swap(Object[] array, int i, int j) { // We do this instead of Preconditions.checkNotNull to save boxing and array // creation cost. @CanIgnoreReturnValue - static @PolySigned Object checkElementNotNull(@PolySigned Object element, int index) { + static @PolySigned Object checkElementNotNull(@PolySigned @Readonly Object element, int index) { if (element == null) { throw new NullPointerException("at index " + index); } diff --git a/guava/src/com/google/common/collect/Ordering.java b/guava/src/com/google/common/collect/Ordering.java index 4085067fb2d9..825183380429 100644 --- a/guava/src/com/google/common/collect/Ordering.java +++ b/guava/src/com/google/common/collect/Ordering.java @@ -40,8 +40,12 @@ import java.util.concurrent.atomic.AtomicInteger; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * A comparator, with additional methods to support common operations. This is an "enriched" version @@ -146,10 +150,10 @@ * @author Kevin Bourrillion * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class Ordering implements Comparator { +public abstract class Ordering implements Comparator { // Natural order /** @@ -163,7 +167,7 @@ public abstract class Ordering implements Comparator */ @GwtCompatible(serializable = true) @SuppressWarnings("unchecked") // TODO(kevinb): right way to explain this?? - public static Ordering natural() { + public static Ordering natural() { return (Ordering) NaturalOrdering.INSTANCE; } @@ -183,7 +187,7 @@ public static Ordering natural() { * wraps that comparator */ @GwtCompatible(serializable = true) - public static Ordering from(Comparator comparator) { + public static Ordering from(Comparator comparator) { return (comparator instanceof Ordering) ? (Ordering) comparator : new ComparatorOrdering(comparator); @@ -196,7 +200,7 @@ public static Ordering natural() { */ @GwtCompatible(serializable = true) @Deprecated - public static Ordering from(Ordering ordering) { + public static Ordering from(Ordering ordering) { return checkNotNull(ordering); } @@ -221,7 +225,8 @@ public static Ordering natural() { */ // TODO(kevinb): provide replacement @GwtCompatible(serializable = true) - public static Ordering explicit(List valuesInOrder) { + @CFComment("T is Immutable because ExplicitOrdering requires an immutable T") + public static Ordering explicit(List valuesInOrder) { return new ExplicitOrdering(valuesInOrder); } @@ -283,7 +288,7 @@ public static Ordering explicit(T leastValue, T... remainingValuesInOrder */ @GwtCompatible(serializable = true) @SuppressWarnings("unchecked") - public static Ordering<@Nullable Object> allEqual() { + public static Ordering<@Nullable @Readonly Object> allEqual() { return AllEqualOrdering.INSTANCE; } @@ -296,7 +301,7 @@ public static Ordering explicit(T leastValue, T... remainingValuesInOrder *

Java 8 users: Use {@code Comparator.comparing(Object::toString)} instead. */ @GwtCompatible(serializable = true) - public static Ordering usingToString() { + public static Ordering<@Readonly Object> usingToString() { return UsingToStringOrdering.INSTANCE; } @@ -316,22 +321,22 @@ public static Ordering usingToString() { * @since 2.0 */ // TODO(kevinb): copy to Comparators, etc. - public static Ordering<@Nullable Object> arbitrary() { + public static Ordering<@Nullable @Readonly Object> arbitrary() { return ArbitraryOrderingHolder.ARBITRARY_ORDERING; } private static class ArbitraryOrderingHolder { - static final Ordering<@Nullable Object> ARBITRARY_ORDERING = new ArbitraryOrdering(); + static final Ordering<@Nullable @Readonly Object> ARBITRARY_ORDERING = new ArbitraryOrdering(); } @VisibleForTesting - static class ArbitraryOrdering extends Ordering<@Nullable Object> { + static class ArbitraryOrdering extends Ordering<@Nullable @Readonly Object> { private final AtomicInteger counter = new AtomicInteger(0); - private final ConcurrentMap uids = + private final ConcurrentMap<@Immutable Object, Integer> uids = Platform.tryWeakKeys(new MapMaker()).makeMap(); - private Integer getUid(Object obj) { + private Integer getUid(@Readonly Object obj) { Integer uid = uids.get(obj); if (uid == null) { // One or more integer values could be skipped in the event of a race @@ -347,7 +352,7 @@ private Integer getUid(Object obj) { } @Override - public int compare(@CheckForNull Object left, @CheckForNull Object right) { + public int compare(@CheckForNull @Readonly Object left, @CheckForNull @Readonly Object right) { if (left == right) { return 0; } else if (left == null) { @@ -382,7 +387,7 @@ public String toString() { * recognize that the call is 1-morphic and should still be willing to * inline it if necessary. */ - int identityHashCode(Object object) { + int identityHashCode(@Readonly Object object) { return System.identityHashCode(object); } } @@ -450,11 +455,11 @@ public Ordering reverse() { * can omit the comparator if it is the natural order). */ @GwtCompatible(serializable = true) - public Ordering onResultOf(Function function) { + public Ordering onResultOf(Function function) { return new ByFunctionOrdering<>(function, this); } - Ordering> onKeys() { + Ordering> onKeys() { return onResultOf(Maps.keyFunction()); } @@ -496,7 +501,7 @@ public Ordering compound(Comparator secondaryCompara * @param comparators the comparators to try in order */ @GwtCompatible(serializable = true) - public static Ordering compound( + public static Ordering compound( Iterable> comparators) { return new CompoundOrdering(comparators); } @@ -949,10 +954,11 @@ public int binarySearch( * Extending {@link ClassCastException} may seem odd, but it is required. */ @VisibleForTesting + @ReceiverDependentMutable static class IncomparableValueException extends ClassCastException { final Object value; - IncomparableValueException(Object value) { + IncomparableValueException(@ReceiverDependentMutable Object value) { super("Cannot compare value: " + value); this.value = value; } diff --git a/guava/src/com/google/common/collect/PeekingIterator.java b/guava/src/com/google/common/collect/PeekingIterator.java index 1e82ddbf942e..fdc6a983283a 100644 --- a/guava/src/com/google/common/collect/PeekingIterator.java +++ b/guava/src/com/google/common/collect/PeekingIterator.java @@ -22,6 +22,9 @@ import java.util.Iterator; import java.util.NoSuchElementException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -36,9 +39,10 @@ */ @DoNotMock("Use Iterators.peekingIterator") @GwtCompatible -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @ElementTypesAreNonnullByDefault -public interface PeekingIterator extends Iterator { +@ReceiverDependentMutable +public interface PeekingIterator extends Iterator { /** * Returns the next element in the iteration, without advancing the iteration. * @@ -49,7 +53,7 @@ public interface PeekingIterator extends Iterator * #hasNext()} */ @ParametricNullness - E peek(); + E peek(@Readonly PeekingIterator this); /** * {@inheritDoc} @@ -60,7 +64,7 @@ public interface PeekingIterator extends Iterator @CanIgnoreReturnValue @Override @ParametricNullness - E next(); + E next(@Mutable PeekingIterator this); /** * {@inheritDoc} @@ -73,5 +77,5 @@ public interface PeekingIterator extends Iterator * (optional) */ @Override - void remove(); + void remove(@Mutable PeekingIterator this); } diff --git a/guava/src/com/google/common/collect/Platform.java b/guava/src/com/google/common/collect/Platform.java index 8ee4b651cd5c..61b5d2534924 100644 --- a/guava/src/com/google/common/collect/Platform.java +++ b/guava/src/com/google/common/collect/Platform.java @@ -23,6 +23,9 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -38,7 +41,7 @@ final class Platform { java.util.logging.Logger.getLogger(Platform.class.getName()); /** Returns the platform preferred implementation of a map based on a hash table. */ - static + static Map newHashMapWithExpectedSize(int expectedSize) { return Maps.newHashMapWithExpectedSize(expectedSize); } @@ -47,13 +50,13 @@ Map newHashMapWithExpectedSize(int expectedSize) { * Returns the platform preferred implementation of an insertion ordered map based on a hash * table. */ - static + static Map newLinkedHashMapWithExpectedSize(int expectedSize) { return Maps.newLinkedHashMapWithExpectedSize(expectedSize); } /** Returns the platform preferred implementation of a set based on a hash table. */ - static Set newHashSetWithExpectedSize(int expectedSize) { + static Set newHashSetWithExpectedSize(int expectedSize) { return Sets.newHashSetWithExpectedSize(expectedSize); } @@ -66,7 +69,7 @@ static Set newConcurrentHashSet() { * Returns the platform preferred implementation of an insertion ordered set based on a hash * table. */ - static Set newLinkedHashSetWithExpectedSize(int expectedSize) { + static Set newLinkedHashSetWithExpectedSize(int expectedSize) { return Sets.newLinkedHashSetWithExpectedSize(expectedSize); } @@ -74,7 +77,7 @@ static Set newConcurrentHashSet() { * Returns the platform preferred map implementation that preserves insertion order when used only * for insertions. */ - static + static Map preservesInsertionOrderOnPutsMap() { return Maps.newLinkedHashMap(); } @@ -83,7 +86,7 @@ Map preservesInsertionOrderOnPutsMap() { * Returns the platform preferred set implementation that preserves insertion order when used only * for insertions. */ - static Set preservesInsertionOrderOnAddsSet() { + static Set preservesInsertionOrderOnAddsSet() { return Sets.newLinkedHashSet(); } @@ -99,7 +102,7 @@ Map preservesInsertionOrderOnPutsMap() { * about arrays for now, as they're a mess. (We previously discussed this in the review of * ObjectArrays, which is the main caller of this method.) */ - static T[] newArray(T[] reference, int length) { + static T[] newArray(T[] reference, int length) { Class type = reference.getClass().getComponentType(); // the cast is safe because @@ -119,7 +122,7 @@ Map preservesInsertionOrderOnPutsMap() { * - https://github.com/jspecify/jdk/commit/71d826792b8c7ef95d492c50a274deab938f2552 */ @SuppressWarnings("nullness") - static T[] copy(Object[] source, int from, int to, T[] arrayOfType) { + static T @Mutable [] copy(Object @Readonly [] source, int from, int to, T @Readonly [] arrayOfType) { return Arrays.copyOfRange(source, from, to, (Class) arrayOfType.getClass()); } diff --git a/guava/src/com/google/common/collect/Queues.java b/guava/src/com/google/common/collect/Queues.java index a140102fd6db..d8d3575e878c 100644 --- a/guava/src/com/google/common/collect/Queues.java +++ b/guava/src/com/google/common/collect/Queues.java @@ -33,6 +33,8 @@ import java.util.concurrent.SynchronousQueue; import java.util.concurrent.TimeUnit; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; /** * Static utility methods pertaining to {@link Queue} and {@link Deque} instances. Also see this @@ -438,7 +440,7 @@ public static int drainUninterruptibly( * @return a synchronized view of the specified queue * @since 14.0 */ - public static Queue synchronizedQueue(Queue queue) { + public static Queue synchronizedQueue(Queue queue) { return Synchronized.queue(queue, null); } @@ -471,7 +473,7 @@ public static int drainUninterruptibly( * @return a synchronized view of the specified deque * @since 15.0 */ - public static Deque synchronizedDeque(Deque deque) { + public static Deque synchronizedDeque(Deque deque) { return Synchronized.deque(deque, null); } } diff --git a/guava/src/com/google/common/collect/Range.java b/guava/src/com/google/common/collect/Range.java index 661ae742ab18..a1112f1db585 100644 --- a/guava/src/com/google/common/collect/Range.java +++ b/guava/src/com/google/common/collect/Range.java @@ -29,6 +29,8 @@ import java.util.NoSuchElementException; import java.util.SortedSet; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -120,7 +122,8 @@ @GwtCompatible @SuppressWarnings("rawtypes") @ElementTypesAreNonnullByDefault -public final class Range extends RangeGwtSerializationDependencies +@Immutable +public final class Range extends RangeGwtSerializationDependencies implements Predicate, Serializable { static class LowerBoundFn implements Function { @@ -675,7 +678,7 @@ public Range canonical(DiscreteDomain domain) { * {@code [3..3)}, {@code (3..3]}, {@code (4..4]} are all unequal. */ @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@CheckForNull @Readonly Object object) { if (object instanceof Range) { Range other = (Range) object; return lowerBound.equals(other.lowerBound) && upperBound.equals(other.upperBound); @@ -715,7 +718,7 @@ Object readResolve() { } @SuppressWarnings("unchecked") // this method may throw CCE - static int compareOrThrow(Comparable left, Comparable right) { + static int compareOrThrow(@Readonly Comparable left, @Readonly Comparable right) { return left.compareTo(right); } diff --git a/guava/src/com/google/common/collect/RangeGwtSerializationDependencies.java b/guava/src/com/google/common/collect/RangeGwtSerializationDependencies.java index 222c1285fb4b..bf48f85e0269 100644 --- a/guava/src/com/google/common/collect/RangeGwtSerializationDependencies.java +++ b/guava/src/com/google/common/collect/RangeGwtSerializationDependencies.java @@ -19,6 +19,9 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; + /** * A dummy superclass to support GWT serialization of the element type of a {@link Range}. The GWT * supersource for this class contains a field of type {@code C}. @@ -29,4 +32,5 @@ *

TODO(cpovirk): Consider applying this subclass approach to our other types. */ @GwtCompatible(emulated = true) -abstract class RangeGwtSerializationDependencies implements Serializable {} +@Immutable +abstract class RangeGwtSerializationDependencies implements Serializable {} diff --git a/guava/src/com/google/common/collect/RangeMap.java b/guava/src/com/google/common/collect/RangeMap.java index 69d6edcb2fcb..de5405b0a5c1 100644 --- a/guava/src/com/google/common/collect/RangeMap.java +++ b/guava/src/com/google/common/collect/RangeMap.java @@ -26,7 +26,13 @@ import java.util.function.BiFunction; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A mapping from disjoint nonempty ranges to non-null values. Queries look up the value associated @@ -38,11 +44,13 @@ * @author Louis Wasserman * @since 14.0 */ +@AnnotatedFor("pico") @Beta @DoNotMock("Use ImmutableRangeMap or TreeRangeMap") @GwtIncompatible @ElementTypesAreNonnullByDefault -public interface RangeMap { +@ReceiverDependentMutable +public interface RangeMap { /* * TODO(cpovirk): These docs sometimes say "map" and sometimes say "range map." Pick one, or at * least decide on a policy for when to use which. @@ -55,14 +63,14 @@ public interface RangeMap { * associated with that range is returned. */ @CheckForNull - V get(K key); + V get(@Readonly RangeMap this, K key); /** * Returns the range containing this key and its associated value, if such a range is present in * the range map, or {@code null} otherwise. */ @CheckForNull - Entry, V> getEntry(K key); + @PolyMutable Entry, V> getEntry(@PolyMutable RangeMap this, K key); /** * Returns the minimal range {@linkplain Range#encloses(Range) enclosing} the ranges in this @@ -70,7 +78,7 @@ public interface RangeMap { * * @throws NoSuchElementException if this range map is empty */ - Range span(); + Range span(@Readonly RangeMap this); /** * Maps a range to a specified value (optional operation). @@ -81,7 +89,7 @@ public interface RangeMap { * *

If {@code range} {@linkplain Range#isEmpty() is empty}, then this is a no-op. */ - void put(Range range, V value); + void put(@Mutable RangeMap this, Range range, V value); /** * Maps a range to a specified value, coalescing this range with any existing ranges with the same @@ -101,13 +109,13 @@ public interface RangeMap { * * @since 22.0 */ - void putCoalescing(Range range, V value); + void putCoalescing(@Mutable RangeMap this, Range range, V value); /** Puts all the associations from {@code rangeMap} into this range map (optional operation). */ - void putAll(RangeMap rangeMap); + void putAll(@Mutable RangeMap this, @Readonly RangeMap rangeMap); /** Removes all associations from this range map (optional operation). */ - void clear(); + void clear(@Mutable RangeMap this); /** * Removes all associations from this range map in the specified range (optional operation). @@ -116,7 +124,7 @@ public interface RangeMap { * before and after a call to {@code remove(range)}. If {@code range.contains(k)}, then after a * call to {@code remove(range)}, {@code get(k)} will return {@code null}. */ - void remove(Range range); + void remove(@Mutable RangeMap this, Range range); /** * Merges a value into a part of the map by applying a remapping function. @@ -137,6 +145,7 @@ public interface RangeMap { * @since 28.1 */ void merge( + @Mutable RangeMap this, Range range, @CheckForNull V value, BiFunction remappingFunction); @@ -150,7 +159,7 @@ void merge( * *

It is guaranteed that no empty ranges will be in the returned {@code Map}. */ - Map, V> asMapOfRanges(); + @PolyMutable Map, V> asMapOfRanges(@PolyMutable RangeMap this); /** * Returns a view of this range map as an unmodifiable {@code Map, V>}. Modifications to @@ -163,7 +172,7 @@ void merge( * * @since 19.0 */ - Map, V> asDescendingMapOfRanges(); + @PolyMutable Map, V> asDescendingMapOfRanges(@PolyMutable RangeMap this); /** * Returns a view of the part of this range map that intersects with {@code range}. @@ -179,20 +188,20 @@ void merge( * insert a range not {@linkplain Range#encloses(Range) enclosed} by {@code range}. */ // TODO(cpovirk): Consider documenting that IAE on the various methods that can throw it. - RangeMap subRangeMap(Range range); + @PolyMutable RangeMap subRangeMap(@PolyMutable RangeMap this, Range range); /** * Returns {@code true} if {@code obj} is another {@code RangeMap} that has an equivalent {@link * #asMapOfRanges()}. */ @Override - boolean equals(@CheckForNull Object o); + boolean equals(@Readonly RangeMap this, @CheckForNull @Readonly Object o); /** Returns {@code asMapOfRanges().hashCode()}. */ @Override - int hashCode(@UnknownSignedness RangeMap this); + int hashCode(@UnknownSignedness @Readonly RangeMap this); /** Returns a readable string representation of this range map. */ @Override - String toString(); + String toString(@Readonly RangeMap this); } diff --git a/guava/src/com/google/common/collect/RangeSet.java b/guava/src/com/google/common/collect/RangeSet.java index e420003ea3ce..841537e447a4 100644 --- a/guava/src/com/google/common/collect/RangeSet.java +++ b/guava/src/com/google/common/collect/RangeSet.java @@ -20,7 +20,12 @@ import java.util.NoSuchElementException; import java.util.Set; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A set comprising zero or more {@linkplain Range#isEmpty nonempty}, {@linkplain @@ -50,24 +55,26 @@ * @author Louis Wasserman * @since 14.0 */ +@AnnotatedFor("pico") @Beta @DoNotMock("Use ImmutableRangeSet or TreeRangeSet") @GwtIncompatible @ElementTypesAreNonnullByDefault -public interface RangeSet { +@ReceiverDependentMutable +public interface RangeSet { // TODO(lowasser): consider adding default implementations of some of these methods // Query methods /** Determines whether any of this range set's member ranges contains {@code value}. */ - boolean contains(C value); + boolean contains(@Readonly RangeSet this, C value); /** * Returns the unique range from this range set that {@linkplain Range#contains contains} {@code * value}, or {@code null} if this range set does not contain {@code value}. */ @CheckForNull - Range rangeContaining(C value); + Range rangeContaining(@Readonly RangeSet this, C value); /** * Returns {@code true} if there exists a non-empty range enclosed by both a member range in this @@ -76,13 +83,13 @@ public interface RangeSet { * * @since 20.0 */ - boolean intersects(Range otherRange); + boolean intersects(@Readonly RangeSet this, @Readonly Range otherRange); /** * Returns {@code true} if there exists a member range in this range set which {@linkplain * Range#encloses encloses} the specified range. */ - boolean encloses(Range otherRange); + boolean encloses(@Readonly RangeSet this, @Readonly Range otherRange); /** * Returns {@code true} if for each member range in {@code other} there exists a member range in @@ -93,7 +100,7 @@ public interface RangeSet { *

This is equivalent to checking if this range set {@link #encloses} each of the ranges in * {@code other}. */ - boolean enclosesAll(RangeSet other); + boolean enclosesAll(@Readonly RangeSet this, @Readonly RangeSet other); /** * Returns {@code true} if for each range in {@code other} there exists a member range in this @@ -105,7 +112,7 @@ public interface RangeSet { * * @since 21.0 */ - default boolean enclosesAll(Iterable> other) { + default boolean enclosesAll(@Readonly RangeSet this, @Readonly Iterable> other) { for (Range range : other) { if (!encloses(range)) { return false; @@ -115,7 +122,7 @@ default boolean enclosesAll(Iterable> other) { } /** Returns {@code true} if this range set contains no ranges. */ - boolean isEmpty(); + boolean isEmpty(@Readonly RangeSet this); /** * Returns the minimal range which {@linkplain Range#encloses(Range) encloses} all ranges in this @@ -123,7 +130,7 @@ default boolean enclosesAll(Iterable> other) { * * @throws NoSuchElementException if this range set is {@linkplain #isEmpty() empty} */ - Range span(); + Range span(@Readonly RangeSet this); // Views @@ -133,7 +140,7 @@ default boolean enclosesAll(Iterable> other) { * Iterable#iterator} method return the ranges in increasing order of lower bound (equivalently, * of upper bound). */ - Set> asRanges(); + @PolyMutable Set> asRanges(@PolyMutable RangeSet this); /** * Returns a descending view of the {@linkplain Range#isConnected disconnected} ranges that make @@ -143,7 +150,7 @@ default boolean enclosesAll(Iterable> other) { * * @since 19.0 */ - Set> asDescendingSetOfRanges(); + @PolyMutable Set> asDescendingSetOfRanges(@PolyMutable RangeSet this); /** * Returns a view of the complement of this {@code RangeSet}. @@ -151,7 +158,7 @@ default boolean enclosesAll(Iterable> other) { *

The returned view supports the {@link #add} operation if this {@code RangeSet} supports * {@link #remove}, and vice versa. */ - RangeSet complement(); + @PolyMutable RangeSet complement(@PolyMutable RangeSet this); /** * Returns a view of the intersection of this {@code RangeSet} with the specified range. @@ -160,7 +167,7 @@ default boolean enclosesAll(Iterable> other) { * the caveat that an {@link IllegalArgumentException} is thrown on an attempt to {@linkplain * #add(Range) add} any range not {@linkplain Range#encloses(Range) enclosed} by {@code view}. */ - RangeSet subRangeSet(Range view); + @PolyMutable RangeSet subRangeSet(@PolyMutable RangeSet this, Range view); // Modification @@ -176,7 +183,7 @@ default boolean enclosesAll(Iterable> other) { * @throws UnsupportedOperationException if this range set does not support the {@code add} * operation */ - void add(Range range); + void add(@Mutable RangeSet this, Range range); /** * Removes the specified range from this {@code RangeSet} (optional operation). After this @@ -187,7 +194,7 @@ default boolean enclosesAll(Iterable> other) { * @throws UnsupportedOperationException if this range set does not support the {@code remove} * operation */ - void remove(Range range); + void remove(@Mutable RangeSet this, Range range); /** * Removes all ranges from this {@code RangeSet} (optional operation). After this operation, @@ -198,7 +205,7 @@ default boolean enclosesAll(Iterable> other) { * @throws UnsupportedOperationException if this range set does not support the {@code clear} * operation */ - void clear(); + void clear(@Mutable RangeSet this); /** * Adds all of the ranges from the specified range set to this range set (optional operation). @@ -210,7 +217,7 @@ default boolean enclosesAll(Iterable> other) { * @throws UnsupportedOperationException if this range set does not support the {@code addAll} * operation */ - void addAll(RangeSet other); + void addAll(@Mutable RangeSet this, @Readonly RangeSet other); /** * Adds all of the specified ranges to this range set (optional operation). After this operation, @@ -223,7 +230,7 @@ default boolean enclosesAll(Iterable> other) { * operation * @since 21.0 */ - default void addAll(Iterable> ranges) { + default void addAll(@Mutable RangeSet this, @Readonly Iterable> ranges) { for (Range range : ranges) { add(range); } @@ -240,7 +247,7 @@ default void addAll(Iterable> ranges) { * @throws UnsupportedOperationException if this range set does not support the {@code removeAll} * operation */ - void removeAll(RangeSet other); + void removeAll(@Mutable RangeSet this, @Readonly RangeSet other); /** * Removes all of the specified ranges from this range set (optional operation). @@ -252,7 +259,7 @@ default void addAll(Iterable> ranges) { * operation * @since 21.0 */ - default void removeAll(Iterable> ranges) { + default void removeAll(@Mutable RangeSet this, @Readonly Iterable> ranges) { for (Range range : ranges) { remove(range); } @@ -265,11 +272,11 @@ default void removeAll(Iterable> ranges) { * according to {@link Range#equals(Object)}. */ @Override - boolean equals(@CheckForNull Object obj); + boolean equals(@Readonly RangeSet this, @CheckForNull @Readonly Object obj); /** Returns {@code asRanges().hashCode()}. */ @Override - int hashCode(@UnknownSignedness RangeSet this); + int hashCode(@UnknownSignedness @Readonly RangeSet this); /** * Returns a readable string representation of this range set. For example, if this {@code @@ -277,5 +284,5 @@ default void removeAll(Iterable> ranges) { * return {@code " [1..3](4..+∞)}"}. */ @Override - String toString(); + String toString(@Readonly RangeSet this); } diff --git a/guava/src/com/google/common/collect/RegularContiguousSet.java b/guava/src/com/google/common/collect/RegularContiguousSet.java index afd0417697d7..2f3f8101128d 100644 --- a/guava/src/com/google/common/collect/RegularContiguousSet.java +++ b/guava/src/com/google/common/collect/RegularContiguousSet.java @@ -26,6 +26,8 @@ import java.util.Collection; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -36,7 +38,8 @@ @GwtCompatible(emulated = true) @SuppressWarnings("unchecked") // allow ungenerified Comparable types @ElementTypesAreNonnullByDefault -final class RegularContiguousSet extends ContiguousSet { +@Immutable +final class RegularContiguousSet extends ContiguousSet { private final Range range; RegularContiguousSet(Range range, DiscreteDomain domain) { diff --git a/guava/src/com/google/common/collect/RegularImmutableAsList.java b/guava/src/com/google/common/collect/RegularImmutableAsList.java index 7d0eeb863ae9..46f5f9261dd5 100644 --- a/guava/src/com/google/common/collect/RegularImmutableAsList.java +++ b/guava/src/com/google/common/collect/RegularImmutableAsList.java @@ -21,6 +21,9 @@ import java.util.function.Consumer; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * An {@link ImmutableAsList} implementation specialized for when the delegate collection is already @@ -28,9 +31,11 @@ * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) @SuppressWarnings("serial") // uses writeReplace, not default serialization @ElementTypesAreNonnullByDefault +@Immutable class RegularImmutableAsList extends ImmutableAsList { private final ImmutableCollection delegate; private final ImmutableList delegateList; @@ -40,7 +45,7 @@ class RegularImmutableAsList extends ImmutableAsList { this.delegateList = delegateList; } - RegularImmutableAsList(ImmutableCollection delegate, Object[] array) { + RegularImmutableAsList(ImmutableCollection delegate, Object @Readonly [] array) { this(delegate, ImmutableList.asImmutableList(array)); } @@ -68,7 +73,7 @@ public void forEach(Consumer action) { @GwtIncompatible // not present in emulated superclass @Override - int copyIntoArray(@Nullable Object[] dst, int offset) { + int copyIntoArray(@Nullable @Readonly Object[] dst, int offset) { return delegateList.copyIntoArray(dst, offset); } diff --git a/guava/src/com/google/common/collect/RegularImmutableBiMap.java b/guava/src/com/google/common/collect/RegularImmutableBiMap.java index d9cf279d9b78..bc60d502bce4 100644 --- a/guava/src/com/google/common/collect/RegularImmutableBiMap.java +++ b/guava/src/com/google/common/collect/RegularImmutableBiMap.java @@ -36,6 +36,10 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.framework.qual.AnnotatedFor; @@ -44,33 +48,34 @@ * * @author Louis Wasserman */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization @ElementTypesAreNonnullByDefault -class RegularImmutableBiMap extends ImmutableBiMap { - static final RegularImmutableBiMap EMPTY = +@Immutable +class RegularImmutableBiMap extends ImmutableBiMap { + static final RegularImmutableBiMap<@Immutable Object, @Immutable Object> EMPTY = new RegularImmutableBiMap<>( - null, null, (Entry[]) ImmutableMap.EMPTY_ENTRY_ARRAY, 0, 0); + null, null, (Entry<@Immutable Object, @Immutable Object>[]) ImmutableMap.EMPTY_ENTRY_ARRAY, 0, 0); static final double MAX_LOAD_FACTOR = 1.2; - @CheckForNull private final transient @Nullable ImmutableMapEntry[] keyTable; - @CheckForNull private final transient @Nullable ImmutableMapEntry[] valueTable; - @VisibleForTesting final transient Entry[] entries; + @CheckForNull private final transient @Nullable ImmutableMapEntry @Immutable [] keyTable; + @CheckForNull private final transient @Nullable ImmutableMapEntry @Immutable [] valueTable; + @VisibleForTesting final transient @Immutable Entry @Immutable [] entries; private final transient int mask; private final transient int hashCode; - static ImmutableBiMap fromEntries(Entry... entries) { + static ImmutableBiMap fromEntries(@Immutable Entry... entries) { return fromEntryArray(entries.length, entries); } - static ImmutableBiMap fromEntryArray(int n, @Nullable Entry[] entryArray) { + static ImmutableBiMap fromEntryArray(int n, @Nullable @Immutable Entry @Immutable [] entryArray) { checkPositionIndex(n, entryArray.length); int tableSize = Hashing.closedTableSize(n, MAX_LOAD_FACTOR); int mask = tableSize - 1; - @Nullable ImmutableMapEntry[] keyTable = createEntryArray(tableSize); - @Nullable ImmutableMapEntry[] valueTable = createEntryArray(tableSize); + @Nullable ImmutableMapEntry @Mutable [] keyTable = createEntryArray(tableSize); + @Nullable ImmutableMapEntry @Mutable [] valueTable = createEntryArray(tableSize); /* * The cast is safe: n==entryArray.length means that we have filled the whole array with Entry * instances, in which case it is safe to cast it from an array of nullable entries to an array @@ -114,9 +119,9 @@ static ImmutableBiMap fromEntryArray(int n, @Nullable Entry[] } private RegularImmutableBiMap( - @CheckForNull @Nullable ImmutableMapEntry[] keyTable, - @CheckForNull @Nullable ImmutableMapEntry[] valueTable, - Entry[] entries, + @CheckForNull @Nullable ImmutableMapEntry @Immutable [] keyTable, + @CheckForNull @Nullable ImmutableMapEntry @Immutable [] valueTable, + @Immutable Entry @Immutable [] entries, int mask, int hashCode) { this.keyTable = keyTable; @@ -134,7 +139,7 @@ private RegularImmutableBiMap( * flooding attack */ private static void checkNoConflictInValueBucket( - Object value, Entry entry, @CheckForNull ImmutableMapEntry valueBucketHead) + @Readonly Object value, @Readonly Entry entry, @CheckForNull ImmutableMapEntry valueBucketHead) throws BucketOverflowException { int bucketSize = 0; for (; valueBucketHead != null; valueBucketHead = valueBucketHead.getNextInValueBucket()) { @@ -147,14 +152,14 @@ private static void checkNoConflictInValueBucket( @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { return RegularImmutableMap.get(key, keyTable, mask); } @Override - ImmutableSet> createEntrySet() { + ImmutableSet<@Immutable Entry> createEntrySet() { return isEmpty() - ? ImmutableSet.>of() + ? ImmutableSet.<@Immutable Entry>of() : new ImmutableMapEntrySet.RegularEntrySet(this, entries); } @@ -177,7 +182,7 @@ boolean isHashCodeFast() { } @Override - public int hashCode(@UnknownSignedness RegularImmutableBiMap this) { + public int hashCode(@UnknownSignedness @Readonly RegularImmutableBiMap this) { return hashCode; } @@ -191,7 +196,7 @@ boolean isPartialView() { return entries.length; } - @LazyInit @RetainedWith @CheckForNull private transient ImmutableBiMap inverse; + @LazyInit @RetainedWith @CheckForNull private transient @Assignable ImmutableBiMap inverse; @Override public ImmutableBiMap inverse() { @@ -202,6 +207,7 @@ public ImmutableBiMap inverse() { return (result == null) ? inverse = new Inverse() : result; } + @Immutable private final class Inverse extends ImmutableBiMap { @Override @@ -222,7 +228,7 @@ public void forEach(BiConsumer action) { @Override @CheckForNull - public K get(@CheckForNull @UnknownSignedness Object value) { + public K get(@CheckForNull @UnknownSignedness @Readonly Object value) { if (value == null || valueTable == null) { return null; } @@ -243,10 +249,11 @@ ImmutableSet createKeySet() { } @Override - ImmutableSet> createEntrySet() { + ImmutableSet<@Immutable Entry> createEntrySet() { return new InverseEntrySet(); } + @Immutable final class InverseEntrySet extends ImmutableMapEntrySet { @Override ImmutableMap map() { @@ -259,7 +266,7 @@ boolean isHashCodeFast() { } @Override - public int hashCode(@UnknownSignedness InverseEntrySet this) { + public int hashCode(@UnknownSignedness @Readonly InverseEntrySet this) { return hashCode; } @@ -301,14 +308,14 @@ Object writeReplace() { } } - private static class InverseSerializedForm implements Serializable { + private static class InverseSerializedForm implements Serializable { private final ImmutableBiMap forward; InverseSerializedForm(ImmutableBiMap forward) { this.forward = forward; } - Object readResolve() { + @Immutable Object readResolve() { return forward.inverse(); } diff --git a/guava/src/com/google/common/collect/RegularImmutableList.java b/guava/src/com/google/common/collect/RegularImmutableList.java index 89b5b29705db..06dceaea5082 100644 --- a/guava/src/com/google/common/collect/RegularImmutableList.java +++ b/guava/src/com/google/common/collect/RegularImmutableList.java @@ -22,6 +22,8 @@ import java.util.Spliterators; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -32,16 +34,17 @@ * * @author Kevin Bourrillion */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization @ElementTypesAreNonnullByDefault +@Immutable class RegularImmutableList extends ImmutableList { - static final ImmutableList EMPTY = new RegularImmutableList<>(new Object[0]); + static final ImmutableList<@Readonly Object> EMPTY = new RegularImmutableList<>(new Object[0]); @VisibleForTesting final transient Object[] array; - RegularImmutableList(Object[] array) { + RegularImmutableList(Object @Immutable [] array) { this.array = array; } diff --git a/guava/src/com/google/common/collect/RegularImmutableMap.java b/guava/src/com/google/common/collect/RegularImmutableMap.java index 6ca142d36ee1..96613a1de54a 100644 --- a/guava/src/com/google/common/collect/RegularImmutableMap.java +++ b/guava/src/com/google/common/collect/RegularImmutableMap.java @@ -35,6 +35,9 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -47,10 +50,11 @@ * @author Kevin Bourrillion * @author Gregory Kick */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -final class RegularImmutableMap extends ImmutableMap { +@Immutable +final class RegularImmutableMap extends ImmutableMap { @SuppressWarnings("unchecked") static final ImmutableMap EMPTY = new RegularImmutableMap<>((Entry[]) ImmutableMap.EMPTY_ENTRY_ARRAY, null, 0); @@ -81,7 +85,7 @@ final class RegularImmutableMap extends ImmutableMap { // 'and' with an int to get a table index private final transient int mask; - static ImmutableMap fromEntries(Entry... entries) { + static ImmutableMap fromEntries(@Immutable Entry... entries) { return fromEntryArray(entries.length, entries, /* throwIfDuplicateKeys= */ true); } @@ -90,7 +94,7 @@ static ImmutableMap fromEntries(Entry... entries) { * the entries in entryArray with its own entry objects (though they will have the same key/value * contents), and may take ownership of entryArray. */ - static ImmutableMap fromEntryArray( + static ImmutableMap fromEntryArray( int n, @Nullable Entry[] entryArray, boolean throwIfDuplicateKeys) { checkPositionIndex(n, entryArray.length); if (n == 0) { @@ -107,7 +111,7 @@ static ImmutableMap fromEntryArray( } } - private static ImmutableMap fromEntryArrayCheckingBucketOverflow( + private static ImmutableMap fromEntryArrayCheckingBucketOverflow( int n, @Nullable Entry[] entryArray, boolean throwIfDuplicateKeys) throws BucketOverflowException { /* @@ -186,8 +190,8 @@ private static ImmutableMap fromEntryArrayCheckingBucketOverflow( * been included in the new entry array. * @return an array of {@code newN} entries where no key appears more than once. */ - static Entry[] removeDuplicates( - Entry[] entries, int n, int newN, IdentityHashMap, Boolean> duplicates) { + static Entry[] removeDuplicates( + Entry[] entries, int n, int newN, IdentityHashMap<@Immutable Entry, Boolean> duplicates) { Entry[] newEntries = createEntryArray(newN); for (int in = 0, out = 0; in < n; in++) { Entry entry = entries[in]; @@ -206,14 +210,14 @@ static Entry[] removeDuplicates( } /** Makes an entry usable internally by a new ImmutableMap without rereading its contents. */ - static ImmutableMapEntry makeImmutable(Entry entry, K key, V value) { + static ImmutableMapEntry makeImmutable(@Readonly Entry entry, K key, V value) { boolean reusable = entry instanceof ImmutableMapEntry && ((ImmutableMapEntry) entry).isReusable(); return reusable ? (ImmutableMapEntry) entry : new ImmutableMapEntry(key, value); } /** Makes an entry usable internally by a new ImmutableMap. */ - static ImmutableMapEntry makeImmutable(Entry entry) { + static ImmutableMapEntry makeImmutable(@Readonly Entry entry) { return makeImmutable(entry, entry.getKey(), entry.getValue()); } @@ -236,9 +240,9 @@ private RegularImmutableMap( * flooding attack */ @CanIgnoreReturnValue - static @Nullable ImmutableMapEntry checkNoConflictInKeyBucket( - Object key, - Object newValue, + static @Nullable ImmutableMapEntry checkNoConflictInKeyBucket( + @Readonly Object key, + @Readonly Object newValue, @CheckForNull ImmutableMapEntry keyBucketHead, boolean throwIfDuplicateKeys) throws BucketOverflowException { @@ -262,13 +266,13 @@ static class BucketOverflowException extends Exception {} @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { return get(key, table, mask); } @CheckForNull static V get( - @CheckForNull Object key, + @CheckForNull @Readonly Object key, @CheckForNull @Nullable ImmutableMapEntry[] keyTable, int mask) { if (key == null || keyTable == null) { @@ -323,7 +327,8 @@ ImmutableSet createKeySet() { } @GwtCompatible(emulated = true) - private static final class KeySet extends IndexedImmutableSet { + @Immutable + private static final class KeySet extends IndexedImmutableSet { private final RegularImmutableMap map; KeySet(RegularImmutableMap map) { @@ -353,7 +358,7 @@ boolean isPartialView() { // No longer used for new writes, but kept so that old data can still be read. @GwtIncompatible // serialization @SuppressWarnings("unused") - private static class SerializedForm implements Serializable { + private static class SerializedForm implements Serializable { final ImmutableMap map; SerializedForm(ImmutableMap map) { @@ -374,7 +379,8 @@ ImmutableCollection createValues() { } @GwtCompatible(emulated = true) - private static final class Values extends ImmutableList { + @Immutable + private static final class Values extends ImmutableList { final RegularImmutableMap map; Values(RegularImmutableMap map) { @@ -406,7 +412,7 @@ private static class SerializedForm implements Serializable { this.map = map; } - Object readResolve() { + @Immutable Object readResolve() { return map.values(); } diff --git a/guava/src/com/google/common/collect/RegularImmutableMultiset.java b/guava/src/com/google/common/collect/RegularImmutableMultiset.java index 7408f5ec9f7c..c1fe0b839c5d 100644 --- a/guava/src/com/google/common/collect/RegularImmutableMultiset.java +++ b/guava/src/com/google/common/collect/RegularImmutableMultiset.java @@ -28,7 +28,11 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * Implementation of {@link ImmutableMultiset} with zero or more elements. @@ -36,9 +40,11 @@ * @author Jared Levy * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true, serializable = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization @ElementTypesAreNonnullByDefault +@Immutable class RegularImmutableMultiset extends ImmutableMultiset { private static final ImmutableEntry[] EMPTY_ARRAY = new ImmutableEntry[0]; static final ImmutableMultiset EMPTY = create(ImmutableList.>of()); @@ -125,7 +131,8 @@ private static boolean hashFloodingDetected(@Nullable ImmutableEntry[] hashTa private final transient int size; private final transient int hashCode; - @LazyInit @CheckForNull private transient ImmutableSet elementSet; + @CFComment("Change to @LazyFinal later") + @LazyInit @CheckForNull private transient @Assignable ImmutableSet elementSet; private RegularImmutableMultiset( ImmutableEntry[] entries, @@ -140,6 +147,7 @@ private RegularImmutableMultiset( this.elementSet = elementSet; } + @Immutable private static final class NonTerminalEntry extends ImmutableEntry { private final ImmutableEntry nextInBucket; @@ -185,7 +193,7 @@ boolean isPartialView() { @Override public ImmutableSet elementSet() { ImmutableSet result = elementSet; - return (result == null) ? elementSet = new ElementSet(Arrays.asList(entries), this) : result; + return (result == null) ? elementSet = new @Immutable ElementSet(Arrays.asList(entries), this) : result; } @Override diff --git a/guava/src/com/google/common/collect/RegularImmutableSet.java b/guava/src/com/google/common/collect/RegularImmutableSet.java index a3cd41631285..66e575aade50 100644 --- a/guava/src/com/google/common/collect/RegularImmutableSet.java +++ b/guava/src/com/google/common/collect/RegularImmutableSet.java @@ -23,6 +23,8 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -32,10 +34,11 @@ * * @author Kevin Bourrillion */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization @ElementTypesAreNonnullByDefault +@Immutable final class RegularImmutableSet extends ImmutableSet.CachingAsList { private static final Object[] EMPTY_ARRAY = new Object[0]; static final RegularImmutableSet EMPTY = @@ -48,7 +51,7 @@ final class RegularImmutableSet extends ImmutableSet.CachingAsList { // 'and' with an int to get a valid table index. private final transient int mask; - RegularImmutableSet(Object[] elements, int hashCode, @Nullable Object[] table, int mask) { + RegularImmutableSet(Object @Readonly [] elements, int hashCode, @Nullable Object[] table, int mask) { this.elements = elements; this.hashCode = hashCode; this.table = table; diff --git a/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java b/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java index cdb7e7151aa2..31926d953586 100644 --- a/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java +++ b/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java @@ -26,16 +26,20 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * An immutable sorted multiset with one or more distinct elements. * * @author Louis Wasserman */ +@AnnotatedFor("pico") @SuppressWarnings("serial") // uses writeReplace, not default serialization @GwtIncompatible @ElementTypesAreNonnullByDefault +@Immutable final class RegularImmutableSortedMultiset extends ImmutableSortedMultiset { private static final long[] ZERO_CUMULATIVE_COUNTS = {0}; diff --git a/guava/src/com/google/common/collect/RegularImmutableSortedSet.java b/guava/src/com/google/common/collect/RegularImmutableSortedSet.java index 7ac7d0fed4ed..2abaf54be5b2 100644 --- a/guava/src/com/google/common/collect/RegularImmutableSortedSet.java +++ b/guava/src/com/google/common/collect/RegularImmutableSortedSet.java @@ -31,6 +31,8 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -43,10 +45,11 @@ * @author Jared Levy * @author Louis Wasserman */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings({"serial", "rawtypes"}) @ElementTypesAreNonnullByDefault +@Immutable final class RegularImmutableSortedSet extends ImmutableSortedSet { static final RegularImmutableSortedSet NATURAL_EMPTY_SET = new RegularImmutableSortedSet<>(ImmutableList.of(), Ordering.natural()); @@ -164,7 +167,7 @@ public boolean containsAll(Collection targets) { } } - private int unsafeBinarySearch(Object key) throws ClassCastException { + private int unsafeBinarySearch(@Readonly Object key) throws ClassCastException { return Collections.binarySearch(elements, key, unsafeComparator()); } diff --git a/guava/src/com/google/common/collect/RegularImmutableTable.java b/guava/src/com/google/common/collect/RegularImmutableTable.java index 0b71914ead32..7ba68f0af7a4 100644 --- a/guava/src/com/google/common/collect/RegularImmutableTable.java +++ b/guava/src/com/google/common/collect/RegularImmutableTable.java @@ -27,16 +27,21 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * An implementation of {@link ImmutableTable} holding an arbitrary number of cells. * * @author Gregory Kick */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class RegularImmutableTable extends ImmutableTable { +@Immutable +abstract class RegularImmutableTable extends ImmutableTable { RegularImmutableTable() {} abstract Cell getCell(int iterationIndex); @@ -47,6 +52,7 @@ final ImmutableSet> createCellSet() { } @WeakOuter + @Immutable private final class CellSet extends IndexedImmutableSet> { @Override public @NonNegative int size() { @@ -82,6 +88,7 @@ final ImmutableCollection createValues() { } @WeakOuter + @Immutable private final class Values extends ImmutableList { @Override public @NonNegative int size() { @@ -99,7 +106,7 @@ boolean isPartialView() { } } - static RegularImmutableTable forCells( + static RegularImmutableTable forCells( List> cells, @CheckForNull Comparator rowComparator, @CheckForNull Comparator columnComparator) { @@ -130,11 +137,11 @@ static RegularImmutableTable forCells( return forCellsInternal(cells, rowComparator, columnComparator); } - static RegularImmutableTable forCells(Iterable> cells) { + static RegularImmutableTable forCells(Iterable> cells) { return forCellsInternal(cells, null, null); } - private static RegularImmutableTable forCellsInternal( + private static RegularImmutableTable forCellsInternal( Iterable> cells, @CheckForNull Comparator rowComparator, @CheckForNull Comparator columnComparator) { @@ -159,7 +166,7 @@ private static RegularImmutableTable forCellsInternal( } /** A factory that chooses the most space-efficient representation of the table. */ - static RegularImmutableTable forOrderedComponents( + static RegularImmutableTable forOrderedComponents( ImmutableList> cellList, ImmutableSet rowSpace, ImmutableSet columnSpace) { diff --git a/guava/src/com/google/common/collect/ReverseNaturalOrdering.java b/guava/src/com/google/common/collect/ReverseNaturalOrdering.java index 04e3e1709dbd..070006a25b27 100644 --- a/guava/src/com/google/common/collect/ReverseNaturalOrdering.java +++ b/guava/src/com/google/common/collect/ReverseNaturalOrdering.java @@ -21,15 +21,16 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; import java.util.Iterator; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; /** An ordering that uses the reverse of the natural order of the values. */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true) @SuppressWarnings({"unchecked", "rawtypes"}) // TODO(kevinb): the right way to explain this?? @ElementTypesAreNonnullByDefault -final class ReverseNaturalOrdering extends Ordering> implements Serializable { +final class ReverseNaturalOrdering extends Ordering<@Readonly Comparable> implements Serializable { static final ReverseNaturalOrdering INSTANCE = new ReverseNaturalOrdering(); @Pure @@ -40,53 +41,53 @@ public int compare(Comparable left, Comparable right) { return 0; } - return ((Comparable) right).compareTo(left); + return ((Comparable<@Readonly Object>) right).compareTo(left); } @Override - public > Ordering reverse() { + public > Ordering reverse() { return Ordering.natural(); } // Override the min/max methods to "hoist" delegation outside loops @Override - public > E min(E a, E b) { + public > E min(E a, E b) { return NaturalOrdering.INSTANCE.max(a, b); } @Override - public > E min(E a, E b, E c, E... rest) { + public > E min(E a, E b, E c, E... rest) { return NaturalOrdering.INSTANCE.max(a, b, c, rest); } @Override - public > E min(Iterator iterator) { + public > E min(Iterator iterator) { return NaturalOrdering.INSTANCE.max(iterator); } @Override - public > E min(Iterable iterable) { + public > E min(Iterable iterable) { return NaturalOrdering.INSTANCE.max(iterable); } @Override - public > E max(E a, E b) { + public > E max(E a, E b) { return NaturalOrdering.INSTANCE.min(a, b); } @Override - public > E max(E a, E b, E c, E... rest) { + public > E max(E a, E b, E c, E... rest) { return NaturalOrdering.INSTANCE.min(a, b, c, rest); } @Override - public > E max(Iterator iterator) { + public > E max(Iterator iterator) { return NaturalOrdering.INSTANCE.min(iterator); } @Override - public > E max(Iterable iterable) { + public > E max(Iterable iterable) { return NaturalOrdering.INSTANCE.min(iterable); } diff --git a/guava/src/com/google/common/collect/ReverseOrdering.java b/guava/src/com/google/common/collect/ReverseOrdering.java index fe6d7bec74cf..0eee485f8dbe 100644 --- a/guava/src/com/google/common/collect/ReverseOrdering.java +++ b/guava/src/com/google/common/collect/ReverseOrdering.java @@ -24,14 +24,15 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; /** An ordering that uses the reverse of a given order. */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -final class ReverseOrdering extends Ordering +final class ReverseOrdering extends Ordering implements Serializable { final Ordering forwardOrder; @@ -103,7 +104,7 @@ public int hashCode(@UnknownSignedness ReverseOrdering this) { @Pure @Override - public boolean equals(@CheckForNull Object object) { + public boolean equals(@CheckForNull @Readonly Object object) { if (object == this) { return true; } diff --git a/guava/src/com/google/common/collect/RowSortedTable.java b/guava/src/com/google/common/collect/RowSortedTable.java index 2c2d773f78db..c3effd1d5dcc 100644 --- a/guava/src/com/google/common/collect/RowSortedTable.java +++ b/guava/src/com/google/common/collect/RowSortedTable.java @@ -22,6 +22,9 @@ import java.util.SortedMap; import java.util.SortedSet; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * Interface that extends {@code Table} and whose rows are sorted. @@ -35,8 +38,9 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault +@ReceiverDependentMutable public interface RowSortedTable< - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends Table { /** * {@inheritDoc} diff --git a/guava/src/com/google/common/collect/Serialization.java b/guava/src/com/google/common/collect/Serialization.java index ce584b1d12f0..821ee7b010df 100644 --- a/guava/src/com/google/common/collect/Serialization.java +++ b/guava/src/com/google/common/collect/Serialization.java @@ -24,6 +24,9 @@ import java.util.Collection; import java.util.Map; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -34,7 +37,7 @@ * * @author Jared Levy */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtIncompatible @ElementTypesAreNonnullByDefault final class Serialization { @@ -58,7 +61,7 @@ static int readCount(ObjectInputStream stream) throws IOException { *

The serialized output consists of the number of entries, first key, first value, second key, * second value, and so on. */ - static void writeMap( + static void writeMap( Map map, ObjectOutputStream stream) throws IOException { stream.writeInt(map.size()); for (Map.Entry entry : map.entrySet()) { @@ -71,7 +74,7 @@ static int readCount(ObjectInputStream stream) throws IOException { * Populates a map by reading an input stream, as part of deserialization. See {@link #writeMap} * for the data format. */ - static void populateMap( + static void populateMap( Map map, ObjectInputStream stream) throws IOException, ClassNotFoundException { int size = stream.readInt(); populateMap(map, stream, size); @@ -81,7 +84,7 @@ static int readCount(ObjectInputStream stream) throws IOException { * Populates a map by reading an input stream, as part of deserialization. See {@link #writeMap} * for the data format. The size is determined by a prior call to {@link #readCount}. */ - static void populateMap( + static void populateMap( Map map, ObjectInputStream stream, int size) throws IOException, ClassNotFoundException { for (int i = 0; i < size; i++) { @@ -100,7 +103,7 @@ static int readCount(ObjectInputStream stream) throws IOException { *

The serialized output consists of the number of distinct elements, the first element, its * count, the second element, its count, and so on. */ - static void writeMultiset( + static void writeMultiset( Multiset multiset, ObjectOutputStream stream) throws IOException { int entryCount = multiset.entrySet().size(); stream.writeInt(entryCount); @@ -114,7 +117,7 @@ static int readCount(ObjectInputStream stream) throws IOException { * Populates a multiset by reading an input stream, as part of deserialization. See {@link * #writeMultiset} for the data format. */ - static void populateMultiset( + static void populateMultiset( Multiset multiset, ObjectInputStream stream) throws IOException, ClassNotFoundException { int distinctElements = stream.readInt(); populateMultiset(multiset, stream, distinctElements); @@ -125,7 +128,7 @@ static int readCount(ObjectInputStream stream) throws IOException { * #writeMultiset} for the data format. The number of distinct elements is determined by a prior * call to {@link #readCount}. */ - static void populateMultiset( + static void populateMultiset( Multiset multiset, ObjectInputStream stream, int distinctElements) throws IOException, ClassNotFoundException { for (int i = 0; i < distinctElements; i++) { @@ -144,7 +147,7 @@ static int readCount(ObjectInputStream stream) throws IOException { *

The serialized output consists of the number of distinct keys, and then for each distinct * key: the key, the number of values for that key, and the key's values. */ - static void writeMultimap( + static void writeMultimap( Multimap multimap, ObjectOutputStream stream) throws IOException { stream.writeInt(multimap.asMap().size()); for (Map.Entry> entry : multimap.asMap().entrySet()) { @@ -160,7 +163,7 @@ static int readCount(ObjectInputStream stream) throws IOException { * Populates a multimap by reading an input stream, as part of deserialization. See {@link * #writeMultimap} for the data format. */ - static void populateMultimap( + static void populateMultimap( Multimap multimap, ObjectInputStream stream) throws IOException, ClassNotFoundException { int distinctKeys = stream.readInt(); @@ -172,7 +175,7 @@ static int readCount(ObjectInputStream stream) throws IOException { * #writeMultimap} for the data format. The number of distinct keys is determined by a prior call * to {@link #readCount}. */ - static void populateMultimap( + static void populateMultimap( Multimap multimap, ObjectInputStream stream, int distinctKeys) throws IOException, ClassNotFoundException { for (int i = 0; i < distinctKeys; i++) { @@ -199,6 +202,7 @@ static FieldSetter getFieldSetter(Class clazz, String fieldName) { } // Secret sauce for setting final fields; don't make it public. + @ReceiverDependentMutable static final class FieldSetter { private final Field field; @@ -207,7 +211,7 @@ private FieldSetter(Field field) { field.setAccessible(true); } - void set(T instance, Object value) { + void set(T instance, @Readonly Object value) { try { field.set(instance, value); } catch (IllegalAccessException impossible) { diff --git a/guava/src/com/google/common/collect/SetMultimap.java b/guava/src/com/google/common/collect/SetMultimap.java index 291b5e207a03..df88ef395ca8 100644 --- a/guava/src/com/google/common/collect/SetMultimap.java +++ b/guava/src/com/google/common/collect/SetMultimap.java @@ -24,6 +24,11 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -54,9 +59,10 @@ * @since 2.0 */ @GwtCompatible -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @ElementTypesAreNonnullByDefault -public interface SetMultimap +@ReceiverDependentMutable +public interface SetMultimap extends Multimap { /** * {@inheritDoc} @@ -66,7 +72,7 @@ public interface SetMultimap get(@ParametricNullness K key); + @PolyMutable Set get(@PolyMutable SetMultimap this, @ParametricNullness K key); /** * {@inheritDoc} @@ -77,7 +83,7 @@ public interface SetMultimap removeAll(@CheckForNull Object key); + @Readonly Set removeAll(@Mutable SetMultimap this, @CheckForNull @Readonly Object key); /** * {@inheritDoc} @@ -90,7 +96,7 @@ public interface SetMultimap replaceValues(@ParametricNullness K key, Iterable values); + @Readonly Set replaceValues(@Mutable SetMultimap this, @ParametricNullness K key, Iterable values); /** * {@inheritDoc} @@ -100,7 +106,7 @@ public interface SetMultimap> entries(); + @PolyMutable Set<@PolyMutable Entry> entries(@PolyMutable SetMultimap this); /** * {@inheritDoc} @@ -110,7 +116,7 @@ public interface SetMultimap> asMap(); + @PolyMutable Map> asMap(@PolyMutable SetMultimap this); /** * Compares the specified object to this multimap for equality. @@ -123,5 +129,5 @@ public interface SetMultimap this, @CheckForNull @Readonly Object obj); } diff --git a/guava/src/com/google/common/collect/Sets.java b/guava/src/com/google/common/collect/Sets.java index f4d6f0175934..627699bbc98e 100644 --- a/guava/src/com/google/common/collect/Sets.java +++ b/guava/src/com/google/common/collect/Sets.java @@ -56,6 +56,11 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; @@ -73,7 +78,7 @@ * @author Chris Povirk * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault public final class Sets { @@ -83,14 +88,15 @@ private Sets() {} * {@link AbstractSet} substitute without the potentially-quadratic {@code removeAll} * implementation. */ - abstract static class ImprovedAbstractSet extends AbstractSet { + @ReceiverDependentMutable + abstract static class ImprovedAbstractSet extends AbstractSet { @Override - public boolean removeAll(Collection c) { + public boolean removeAll(@Mutable ImprovedAbstractSet this, @Readonly Collection c) { return removeAllImpl(this, c); } @Override - public boolean retainAll(Collection c) { + public boolean retainAll(@Mutable ImprovedAbstractSet this, @Readonly Collection c) { return super.retainAll(checkNotNull(c)); // GWT compatibility } } @@ -184,7 +190,7 @@ public static > EnumSet newEnumSet( * use the {@code HashSet} constructor directly, taking advantage of "diamond" syntax. */ - public static HashSet newHashSet() { + public static HashSet newHashSet() { return new HashSet(); } @@ -201,7 +207,7 @@ public static > EnumSet newEnumSet( * asList}{@code (...))}, or for creating an empty set then calling {@link Collections#addAll}. * This method is not actually very useful and will likely be deprecated in the future. */ - public static HashSet newHashSet(E... elements) { + public static HashSet newHashSet(E... elements) { HashSet set = newHashSetWithExpectedSize(elements.length); Collections.addAll(set, elements); return set; @@ -225,7 +231,7 @@ public static > EnumSet newEnumSet( * *

Overall, this method is not very useful and will likely be deprecated in the future. */ - public static HashSet newHashSet(Iterable elements) { + public static HashSet newHashSet(Iterable elements) { return (elements instanceof Collection) ? new HashSet((Collection) elements) : newHashSet(elements.iterator()); @@ -243,7 +249,7 @@ public static > EnumSet newEnumSet( * *

Overall, this method is not very useful and will likely be deprecated in the future. */ - public static HashSet newHashSet(Iterator elements) { + public static HashSet newHashSet(Iterator elements) { HashSet set = newHashSet(); Iterators.addAll(set, elements); return set; @@ -261,7 +267,7 @@ public static > EnumSet newEnumSet( * without resizing * @throws IllegalArgumentException if {@code expectedSize} is negative */ - public static HashSet newHashSetWithExpectedSize( + public static HashSet newHashSetWithExpectedSize( int expectedSize) { return new HashSet(Maps.capacity(expectedSize)); } @@ -312,7 +318,7 @@ public static Set newConcurrentHashSet(Iterable elements) { * * @return a new, empty {@code LinkedHashSet} */ - public static LinkedHashSet newLinkedHashSet() { + public static LinkedHashSet newLinkedHashSet() { return new LinkedHashSet(); } @@ -331,7 +337,7 @@ public static Set newConcurrentHashSet(Iterable elements) { * @param elements the elements that the set should contain, in order * @return a new {@code LinkedHashSet} containing those elements (minus duplicates) */ - public static LinkedHashSet newLinkedHashSet( + public static LinkedHashSet newLinkedHashSet( Iterable elements) { if (elements instanceof Collection) { return new LinkedHashSet((Collection) elements); @@ -353,7 +359,7 @@ public static Set newConcurrentHashSet(Iterable elements) { * @throws IllegalArgumentException if {@code expectedSize} is negative * @since 11.0 */ - public static LinkedHashSet newLinkedHashSetWithExpectedSize( + public static LinkedHashSet newLinkedHashSetWithExpectedSize( int expectedSize) { return new LinkedHashSet(Maps.capacity(expectedSize)); } @@ -372,7 +378,7 @@ public static Set newConcurrentHashSet(Iterable elements) { * * @return a new, empty {@code TreeSet} */ - public static TreeSet newTreeSet() { + public static TreeSet newTreeSet() { return new TreeSet(); } @@ -397,7 +403,7 @@ public static Set newConcurrentHashSet(Iterable elements) { * @param elements the elements that the set should contain * @return a new {@code TreeSet} containing those elements (minus duplicates) */ - public static TreeSet newTreeSet(Iterable elements) { + public static TreeSet newTreeSet(Iterable elements) { TreeSet set = newTreeSet(); Iterables.addAll(set, elements); return set; @@ -419,7 +425,7 @@ public static Set newConcurrentHashSet(Iterable elements) { * @return a new, empty {@code TreeSet} * @throws NullPointerException if {@code comparator} is null */ - public static TreeSet newTreeSet( + public static TreeSet newTreeSet( Comparator comparator) { return new TreeSet(checkNotNull(comparator)); } @@ -433,7 +439,7 @@ public static Set newConcurrentHashSet(Iterable elements) { * * @since 8.0 */ - public static Set newIdentityHashSet() { + public static Set newIdentityHashSet() { return Collections.newSetFromMap(Maps.newIdentityHashMap()); } @@ -447,7 +453,7 @@ public static Set newConcurrentHashSet(Iterable elements) { * @since 12.0 */ @GwtIncompatible // CopyOnWriteArraySet - public static CopyOnWriteArraySet newCopyOnWriteArraySet() { + public static CopyOnWriteArraySet newCopyOnWriteArraySet() { return new CopyOnWriteArraySet(); } @@ -459,8 +465,8 @@ public static Set newConcurrentHashSet(Iterable elements) { * @since 12.0 */ @GwtIncompatible // CopyOnWriteArraySet - public static CopyOnWriteArraySet newCopyOnWriteArraySet( - Iterable elements) { + public static CopyOnWriteArraySet newCopyOnWriteArraySet( + @Readonly Iterable elements) { // We copy elements to an ArrayList first, rather than incurring the // quadratic cost of adding them to the COWAS directly. Collection elementsCollection = @@ -483,7 +489,7 @@ public static Set newConcurrentHashSet(Iterable elements) { * @throws IllegalArgumentException if {@code collection} is not an {@code EnumSet} instance and * contains no elements */ - public static > EnumSet complementOf(Collection collection) { + public static > EnumSet complementOf(@Readonly Collection collection) { if (collection instanceof EnumSet) { return EnumSet.complementOf((EnumSet) collection); } @@ -504,7 +510,7 @@ public static > EnumSet complementOf(Collection collecti * present in the given collection */ public static > EnumSet complementOf( - Collection collection, Class type) { + @Readonly Collection collection, Class type) { checkNotNull(collection); return (collection instanceof EnumSet) ? EnumSet.complementOf((EnumSet) collection) @@ -512,7 +518,7 @@ public static > EnumSet complementOf( } private static > EnumSet makeComplementByHand( - Collection collection, Class type) { + @Readonly Collection collection, Class type) { EnumSet result = EnumSet.allOf(type); result.removeAll(collection); return result; @@ -548,7 +554,7 @@ private static > EnumSet makeComplementByHand( * @deprecated Use {@link Collections#newSetFromMap} instead. */ @Deprecated - public static Set newSetFromMap( + public static Set newSetFromMap( Map map) { return Collections.newSetFromMap(map); } @@ -562,7 +568,8 @@ private static > EnumSet makeComplementByHand( * * @since 2.0 */ - public abstract static class SetView extends AbstractSet { + @ReceiverDependentMutable + public abstract static class SetView extends AbstractSet { private SetView() {} // no subclasses but our own /** @@ -709,7 +716,7 @@ public final void clear() { * equivalence relations, for example if {@code set1} is a {@link HashSet} and {@code set2} is a * {@link TreeSet} or the {@link Map#keySet} of an {@code IdentityHashMap}. */ - public static SetView union( + public static SetView union( final Set set1, final Set set2) { checkNotNull(set1, "set1"); checkNotNull(set2, "set2"); @@ -734,8 +741,8 @@ public boolean isEmpty() { } @Override - public UnmodifiableIterator iterator() { - return new AbstractIterator() { + public @Readonly UnmodifiableIterator iterator() { + return new @Immutable AbstractIterator() { final Iterator itr1 = set1.iterator(); final Iterator itr2 = set2.iterator(); @@ -767,7 +774,7 @@ public Stream parallelStream() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object object) { return set1.contains(object) || set2.contains(object); } @@ -813,7 +820,7 @@ public ImmutableSet immutableCopy() { * *

This is unfortunate, but should come up only very rarely. */ - public static SetView intersection( + public static SetView intersection( final Set set1, final Set set2) { checkNotNull(set1, "set1"); checkNotNull(set2, "set2"); @@ -821,7 +828,7 @@ public ImmutableSet immutableCopy() { return new SetView() { @Override public UnmodifiableIterator iterator() { - return new AbstractIterator() { + return new @Immutable AbstractIterator() { final Iterator itr = set1.iterator(); @Override @@ -886,7 +893,7 @@ public boolean containsAll(Collection collection) { * equivalence relations, for example if {@code set1} is a {@link HashSet} and {@code set2} is a * {@link TreeSet} or the {@link Map#keySet} of an {@code IdentityHashMap}. */ - public static SetView difference( + public static SetView difference( final Set set1, final Set set2) { checkNotNull(set1, "set1"); checkNotNull(set2, "set2"); @@ -938,7 +945,7 @@ public boolean isEmpty() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object element) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object element) { return set1.contains(element) && !set2.contains(element); } }; @@ -955,7 +962,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object element) { * * @since 3.0 */ - public static SetView symmetricDifference( + public static SetView symmetricDifference( final Set set1, final Set set2) { checkNotNull(set1, "set1"); checkNotNull(set2, "set2"); @@ -1008,7 +1015,7 @@ public boolean isEmpty() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object element) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object element) { return set1.contains(element) ^ set2.contains(element); } }; @@ -1041,8 +1048,8 @@ public boolean contains(@CheckForNull @UnknownSignedness Object element) { * you to migrate to streams. */ // TODO(kevinb): how to omit that last sentence when building GWT javadoc? - public static Set filter( - Set unfiltered, Predicate predicate) { + public static Set filter( + @Readonly Set unfiltered, Predicate predicate) { if (unfiltered instanceof SortedSet) { return filter((SortedSet) unfiltered, predicate); } @@ -1081,17 +1088,17 @@ public boolean contains(@CheckForNull @UnknownSignedness Object element) { * * @since 11.0 */ - public static SortedSet filter( - SortedSet unfiltered, Predicate predicate) { + public static @PolyMutable SortedSet filter( + @PolyMutable SortedSet unfiltered, Predicate predicate) { if (unfiltered instanceof FilteredSet) { // Support clear(), removeAll(), and retainAll() when filtering a filtered // collection. FilteredSet filtered = (FilteredSet) unfiltered; Predicate combinedPredicate = Predicates.and(filtered.predicate, predicate); - return new FilteredSortedSet((SortedSet) filtered.unfiltered, combinedPredicate); + return new @PolyMutable FilteredSortedSet((SortedSet) filtered.unfiltered, combinedPredicate); } - return new FilteredSortedSet(checkNotNull(unfiltered), checkNotNull(predicate)); + return new @PolyMutable FilteredSortedSet(checkNotNull(unfiltered), checkNotNull(predicate)); } /** @@ -1120,7 +1127,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object element) { */ @GwtIncompatible // NavigableSet @SuppressWarnings("unchecked") - public static NavigableSet filter( + public static NavigableSet filter( NavigableSet unfiltered, Predicate predicate) { if (unfiltered instanceof FilteredSet) { // Support clear(), removeAll(), and retainAll() when filtering a filtered @@ -1133,61 +1140,63 @@ public boolean contains(@CheckForNull @UnknownSignedness Object element) { return new FilteredNavigableSet(checkNotNull(unfiltered), checkNotNull(predicate)); } - private static class FilteredSet extends FilteredCollection + @ReceiverDependentMutable + private static class FilteredSet extends FilteredCollection implements Set { - FilteredSet(Set unfiltered, Predicate predicate) { + FilteredSet(@ReceiverDependentMutable Set unfiltered, Predicate predicate) { super(unfiltered, predicate); } @Override - public boolean equals(@CheckForNull @UnknownSignedness Object object) { + public boolean equals(@Readonly FilteredSet this, @CheckForNull @UnknownSignedness @Readonly Object object) { return equalsImpl(this, object); } @Override - public int hashCode(@UnknownSignedness FilteredSet this) { + public int hashCode(@UnknownSignedness @Readonly FilteredSet this) { return hashCodeImpl(this); } } - private static class FilteredSortedSet extends FilteredSet + @ReceiverDependentMutable + private static class FilteredSortedSet extends FilteredSet implements SortedSet { - FilteredSortedSet(SortedSet unfiltered, Predicate predicate) { + FilteredSortedSet(@ReceiverDependentMutable SortedSet unfiltered, Predicate predicate) { super(unfiltered, predicate); } @Override @CheckForNull - public Comparator comparator() { + public Comparator comparator(@Readonly FilteredSortedSet this) { return ((SortedSet) unfiltered).comparator(); } @Override - public SortedSet subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) { - return new FilteredSortedSet( - ((SortedSet) unfiltered).subSet(fromElement, toElement), predicate); + public @PolyMutable SortedSet subSet(@PolyMutable FilteredSortedSet this, @ParametricNullness E fromElement, @ParametricNullness E toElement) { + return new @PolyMutable FilteredSortedSet( + ((@PolyMutable SortedSet) unfiltered).subSet(fromElement, toElement), predicate); } @Override - public SortedSet headSet(@ParametricNullness E toElement) { - return new FilteredSortedSet(((SortedSet) unfiltered).headSet(toElement), predicate); + public @PolyMutable SortedSet headSet(@PolyMutable FilteredSortedSet this, @ParametricNullness E toElement) { + return new @PolyMutable FilteredSortedSet(((@PolyMutable SortedSet) unfiltered).headSet(toElement), predicate); } @Override - public SortedSet tailSet(@ParametricNullness E fromElement) { - return new FilteredSortedSet(((SortedSet) unfiltered).tailSet(fromElement), predicate); + public @PolyMutable SortedSet tailSet(@PolyMutable FilteredSortedSet this, @ParametricNullness E fromElement) { + return new @PolyMutable FilteredSortedSet(((@PolyMutable SortedSet) unfiltered).tailSet(fromElement), predicate); } @Override @ParametricNullness - public E first() { + public E first(@Readonly FilteredSortedSet this) { return Iterators.find(unfiltered.iterator(), predicate); } @Override @ParametricNullness - public E last() { + public E last(@Readonly FilteredSortedSet this) { SortedSet sortedUnfiltered = (SortedSet) unfiltered; while (true) { E element = sortedUnfiltered.last(); @@ -1200,70 +1209,72 @@ public E last() { } @GwtIncompatible // NavigableSet - private static class FilteredNavigableSet extends FilteredSortedSet + @ReceiverDependentMutable + private static class FilteredNavigableSet extends FilteredSortedSet implements NavigableSet { - FilteredNavigableSet(NavigableSet unfiltered, Predicate predicate) { + FilteredNavigableSet(@ReceiverDependentMutable NavigableSet unfiltered, Predicate predicate) { super(unfiltered, predicate); } - NavigableSet unfiltered() { + @PolyMutable NavigableSet unfiltered(@PolyMutable FilteredNavigableSet this) { return (NavigableSet) unfiltered; } @Override @CheckForNull - public E lower(@ParametricNullness E e) { + public E lower(@Readonly FilteredNavigableSet this, @ParametricNullness E e) { return Iterators.find(unfiltered().headSet(e, false).descendingIterator(), predicate, null); } @Override @CheckForNull - public E floor(@ParametricNullness E e) { + public E floor(@Readonly FilteredNavigableSet this, @ParametricNullness E e) { return Iterators.find(unfiltered().headSet(e, true).descendingIterator(), predicate, null); } @Override @CheckForNull - public E ceiling(@ParametricNullness E e) { + public E ceiling(@Readonly FilteredNavigableSet this, @ParametricNullness E e) { return Iterables.find(unfiltered().tailSet(e, true), predicate, null); } @Override @CheckForNull - public E higher(@ParametricNullness E e) { + public E higher(@Readonly FilteredNavigableSet this, @ParametricNullness E e) { return Iterables.find(unfiltered().tailSet(e, false), predicate, null); } @Override @CheckForNull - public E pollFirst() { + public E pollFirst(@Mutable FilteredNavigableSet this) { return Iterables.removeFirstMatching(unfiltered(), predicate); } @Override @CheckForNull - public E pollLast() { + public E pollLast(@Mutable FilteredNavigableSet this) { return Iterables.removeFirstMatching(unfiltered().descendingSet(), predicate); } @Override - public NavigableSet descendingSet() { + public @PolyMutable NavigableSet descendingSet(@PolyMutable FilteredNavigableSet this) { return Sets.filter(unfiltered().descendingSet(), predicate); } @Override - public Iterator descendingIterator() { + public @Readonly Iterator descendingIterator(@Readonly FilteredNavigableSet this) { return Iterators.filter(unfiltered().descendingIterator(), predicate); } @Override @ParametricNullness - public E last() { + public E last(@Readonly FilteredNavigableSet this) { return Iterators.find(unfiltered().descendingIterator(), predicate); } @Override - public NavigableSet subSet( + public @PolyMutable NavigableSet subSet( + @PolyMutable FilteredNavigableSet this, @ParametricNullness E fromElement, boolean fromInclusive, @ParametricNullness E toElement, @@ -1273,12 +1284,12 @@ public NavigableSet subSet( } @Override - public NavigableSet headSet(@ParametricNullness E toElement, boolean inclusive) { + public @PolyMutable NavigableSet headSet(@PolyMutable FilteredNavigableSet this, @ParametricNullness E toElement, boolean inclusive) { return filter(unfiltered().headSet(toElement, inclusive), predicate); } @Override - public NavigableSet tailSet(@ParametricNullness E fromElement, boolean inclusive) { + public @PolyMutable NavigableSet tailSet(@PolyMutable FilteredNavigableSet this, @ParametricNullness E fromElement, boolean inclusive) { return filter(unfiltered().tailSet(fromElement, inclusive), predicate); } } @@ -1398,6 +1409,7 @@ public static Set> cartesianProduct(Set... sets) { return cartesianProduct(Arrays.asList(sets)); } + @ReceiverDependentMutable private static final class CartesianSet extends ForwardingCollection> implements Set> { private final transient ImmutableList> axes; @@ -1433,18 +1445,18 @@ boolean isPartialView() { return new CartesianSet(axes, new CartesianList(listAxes)); } - private CartesianSet(ImmutableList> axes, CartesianList delegate) { + private CartesianSet(ImmutableList> axes, @ReceiverDependentMutable CartesianList delegate) { this.axes = axes; this.delegate = delegate; } @Override - protected Collection> delegate() { + protected @PolyMutable Collection> delegate(@PolyMutable CartesianSet this) { return delegate; } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object object) { + public boolean contains(@Readonly CartesianSet this, @CheckForNull @UnknownSignedness @Readonly Object object) { if (!(object instanceof List)) { return false; } @@ -1463,7 +1475,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object object) { } @Override - public boolean equals(@CheckForNull @UnknownSignedness Object object) { + public boolean equals(@Readonly CartesianSet this, @CheckForNull @UnknownSignedness @Readonly Object object) { // Warning: this is broken if size() == 0, so it is critical that we // substitute an empty ImmutableSet to the user in place of this if (object instanceof CartesianSet) { @@ -1474,7 +1486,7 @@ public boolean equals(@CheckForNull @UnknownSignedness Object object) { } @Override - public int hashCode(@UnknownSignedness CartesianSet this) { + public int hashCode(@UnknownSignedness @Readonly CartesianSet this) { // Warning: this is broken if size() == 0, so it is critical that we // substitute an empty ImmutableSet to the user in place of this @@ -1521,11 +1533,12 @@ public int hashCode(@UnknownSignedness CartesianSet this) { * @since 4.0 */ @GwtCompatible(serializable = false) - public static Set> powerSet(Set set) { + public static Set<@Readonly Set> powerSet(Set set) { return new PowerSet(set); } - private static final class SubSet extends AbstractSet { + @ReceiverDependentMutable + private static final class SubSet extends AbstractSet { private final ImmutableMap inputSet; private final int mask; @@ -1535,7 +1548,7 @@ private static final class SubSet extends AbstractSet { } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly SubSet this) { return new UnmodifiableIterator() { final ImmutableList elements = inputSet.keySet().asList(); int remainingSetBits = mask; @@ -1558,38 +1571,39 @@ public E next() { } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly SubSet this) { return Integer.bitCount(mask); } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly SubSet this, @CheckForNull @UnknownSignedness @Readonly Object o) { Integer index = inputSet.get(o); return index != null && (mask & (1 << index)) != 0; } } - private static final class PowerSet extends AbstractSet> { + @ReceiverDependentMutable + private static final class PowerSet extends AbstractSet<@Readonly Set> { final ImmutableMap inputSet; - PowerSet(Set input) { + PowerSet(@Readonly Set input) { checkArgument( input.size() <= 30, "Too many elements to create power set: %s > 30", input.size()); this.inputSet = Maps.indexMap(input); } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly PowerSet this) { return 1 << inputSet.size(); } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly PowerSet this) { return false; } @Override - public Iterator> iterator() { + public Iterator> iterator(@Readonly PowerSet this) { return new AbstractIndexedListIterator>(size()) { @Override protected Set get(final int setBits) { @@ -1599,7 +1613,7 @@ protected Set get(final int setBits) { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object obj) { + public boolean contains(@Readonly PowerSet this, @CheckForNull @UnknownSignedness @Readonly Object obj) { if (obj instanceof Set) { Set set = (Set) obj; return inputSet.keySet().containsAll(set); @@ -1608,7 +1622,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object obj) { } @Override - public boolean equals(@CheckForNull @UnknownSignedness Object obj) { + public boolean equals(@CheckForNull @UnknownSignedness @Readonly Object obj) { if (obj instanceof PowerSet) { PowerSet that = (PowerSet) obj; return inputSet.keySet().equals(that.inputSet.keySet()); @@ -1617,7 +1631,7 @@ public boolean equals(@CheckForNull @UnknownSignedness Object obj) { } @Override - public int hashCode(@UnknownSignedness PowerSet this) { + public int hashCode(@UnknownSignedness @Readonly PowerSet this) { /* * The sum of the sums of the hash codes in each subset is just the sum of * each input element's hash code times the number of sets that element @@ -1627,7 +1641,7 @@ public int hashCode(@UnknownSignedness PowerSet this) { } @Override - public String toString() { + public String toString(@Readonly PowerSet this) { return "powerSet(" + inputSet + ")"; } } @@ -1657,7 +1671,7 @@ public String toString() { * @since 23.0 */ @Beta - public static Set> combinations(Set set, final int size) { + public static @Immutable Set> combinations(Set set, final int size) { final ImmutableMap index = Maps.indexMap(set); checkNonnegative(size, "size"); checkArgument(size <= index.size(), "size (%s) must be <= set.size() (%s)", size, index.size()); @@ -1668,7 +1682,7 @@ public static Set> combinations(Set set, final int size) { } return new AbstractSet>() { @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object o) { if (o instanceof Set) { Set s = (Set) o; return s.size() == size && index.keySet().containsAll(s); @@ -1714,7 +1728,7 @@ protected Set computeNext() { final BitSet copy = (BitSet) bits.clone(); return new AbstractSet() { @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object o) { Integer i = index.get(o); return i != null && copy.get(i); } @@ -1759,7 +1773,7 @@ public String toString() { /** An implementation for {@link Set#hashCode()}. */ @Pure - static int hashCodeImpl(Set s) { + static int hashCodeImpl(@Readonly Set s) { int hashCode = 0; for (Object o : s) { hashCode += o != null ? o.hashCode() : 0; @@ -1771,7 +1785,7 @@ static int hashCodeImpl(Set s) { } /** An implementation for {@link Set#equals(Object)}. */ - static boolean equalsImpl(Set s, @CheckForNull @UnknownSignedness Object object) { + static boolean equalsImpl(@Readonly Set s, @CheckForNull @UnknownSignedness @Readonly Object object) { if (s == object) { return true; } @@ -1800,26 +1814,27 @@ static boolean equalsImpl(Set s, @CheckForNull @UnknownSignedness Object obje * @return an unmodifiable view of the specified navigable set * @since 12.0 */ - public static NavigableSet unmodifiableNavigableSet( - NavigableSet set) { + public static @Readonly NavigableSet unmodifiableNavigableSet( + @Readonly NavigableSet set) { if (set instanceof ImmutableCollection || set instanceof UnmodifiableNavigableSet) { return set; } return new UnmodifiableNavigableSet(set); } - static final class UnmodifiableNavigableSet + @Immutable + static final class UnmodifiableNavigableSet extends ForwardingSortedSet implements NavigableSet, Serializable { - private final NavigableSet delegate; - private final SortedSet unmodifiableDelegate; + private final @Readonly NavigableSet delegate; + private final @Readonly SortedSet unmodifiableDelegate; - UnmodifiableNavigableSet(NavigableSet delegate) { + UnmodifiableNavigableSet(@Readonly NavigableSet delegate) { this.delegate = checkNotNull(delegate); this.unmodifiableDelegate = Collections.unmodifiableSortedSet(delegate); } @Override - protected SortedSet delegate() { + protected @Readonly SortedSet delegate() { return unmodifiableDelegate; } @@ -1884,7 +1899,7 @@ public E pollLast() { @CheckForNull private transient UnmodifiableNavigableSet descendingSet; @Override - public NavigableSet descendingSet() { + public @Readonly NavigableSet descendingSet(@Readonly UnmodifiableNavigableSet this) { UnmodifiableNavigableSet result = descendingSet; if (result == null) { result = descendingSet = new UnmodifiableNavigableSet(delegate.descendingSet()); @@ -1894,12 +1909,13 @@ public NavigableSet descendingSet() { } @Override - public Iterator descendingIterator() { + public @Readonly Iterator descendingIterator(@Readonly UnmodifiableNavigableSet this) { return Iterators.unmodifiableIterator(delegate.descendingIterator()); } @Override - public NavigableSet subSet( + public @Readonly NavigableSet subSet( + @Readonly UnmodifiableNavigableSet this, @ParametricNullness E fromElement, boolean fromInclusive, @ParametricNullness E toElement, @@ -1909,12 +1925,12 @@ public NavigableSet subSet( } @Override - public NavigableSet headSet(@ParametricNullness E toElement, boolean inclusive) { + public @Readonly NavigableSet headSet(@Readonly UnmodifiableNavigableSet this, @ParametricNullness E toElement, boolean inclusive) { return unmodifiableNavigableSet(delegate.headSet(toElement, inclusive)); } @Override - public NavigableSet tailSet(@ParametricNullness E fromElement, boolean inclusive) { + public @Readonly NavigableSet tailSet(@Readonly UnmodifiableNavigableSet this, @ParametricNullness E fromElement, boolean inclusive) { return unmodifiableNavigableSet(delegate.tailSet(fromElement, inclusive)); } @@ -1967,7 +1983,7 @@ public NavigableSet tailSet(@ParametricNullness E fromElement, boolean inclus * @since 13.0 */ @GwtIncompatible // NavigableSet - public static NavigableSet synchronizedNavigableSet( + public static NavigableSet synchronizedNavigableSet( NavigableSet navigableSet) { return Synchronized.navigableSet(navigableSet); } @@ -1981,7 +1997,7 @@ static boolean removeAllImpl(Set set, Iterator iterator) { return changed; } - static boolean removeAllImpl(Set set, Collection collection) { + static boolean removeAllImpl(Set set, @Readonly Collection collection) { checkNotNull(collection); // for GWT if (collection instanceof Multiset) { collection = ((Multiset) collection).elementSet(); @@ -2001,66 +2017,68 @@ static boolean removeAllImpl(Set set, Collection collection) { } @GwtIncompatible // NavigableSet - static class DescendingSet extends ForwardingNavigableSet { + @ReceiverDependentMutable + static class DescendingSet extends ForwardingNavigableSet { private final NavigableSet forward; - DescendingSet(NavigableSet forward) { + DescendingSet(@ReceiverDependentMutable NavigableSet forward) { this.forward = forward; } @Override - protected NavigableSet delegate() { + protected @PolyMutable NavigableSet delegate(@PolyMutable DescendingSet this) { return forward; } @Override @CheckForNull - public E lower(@ParametricNullness E e) { + public E lower(@Readonly DescendingSet this, @ParametricNullness E e) { return forward.higher(e); } @Override @CheckForNull - public E floor(@ParametricNullness E e) { + public E floor(@Readonly DescendingSet this, @ParametricNullness E e) { return forward.ceiling(e); } @Override @CheckForNull - public E ceiling(@ParametricNullness E e) { + public E ceiling(@Readonly DescendingSet this, @ParametricNullness E e) { return forward.floor(e); } @Override @CheckForNull - public E higher(@ParametricNullness E e) { + public E higher(@Readonly DescendingSet this, @ParametricNullness E e) { return forward.lower(e); } @Override @CheckForNull - public E pollFirst() { + public E pollFirst(@Mutable DescendingSet this) { return forward.pollLast(); } @Override @CheckForNull - public E pollLast() { + public E pollLast(@Mutable DescendingSet this) { return forward.pollFirst(); } @Override - public NavigableSet descendingSet() { + public @PolyMutable NavigableSet descendingSet(@PolyMutable DescendingSet this) { return forward; } @Override - public Iterator descendingIterator() { + public @PolyMutable Iterator descendingIterator(@PolyMutable DescendingSet this) { return forward.iterator(); } @Override - public NavigableSet subSet( + public @PolyMutable NavigableSet subSet( + @PolyMutable DescendingSet this, @ParametricNullness E fromElement, boolean fromInclusive, @ParametricNullness E toElement, @@ -2069,33 +2087,33 @@ public NavigableSet subSet( } @Override - public SortedSet subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) { + public @PolyMutable SortedSet subSet(@PolyMutable DescendingSet this, @ParametricNullness E fromElement, @ParametricNullness E toElement) { return standardSubSet(fromElement, toElement); } @Override - public NavigableSet headSet(@ParametricNullness E toElement, boolean inclusive) { + public @PolyMutable NavigableSet headSet(@PolyMutable DescendingSet this, @ParametricNullness E toElement, boolean inclusive) { return forward.tailSet(toElement, inclusive).descendingSet(); } @Override - public SortedSet headSet(@ParametricNullness E toElement) { + public @PolyMutable SortedSet headSet(@PolyMutable DescendingSet this, @ParametricNullness E toElement) { return standardHeadSet(toElement); } @Override - public NavigableSet tailSet(@ParametricNullness E fromElement, boolean inclusive) { + public @PolyMutable NavigableSet tailSet(@PolyMutable DescendingSet this, @ParametricNullness E fromElement, boolean inclusive) { return forward.headSet(fromElement, inclusive).descendingSet(); } @Override - public SortedSet tailSet(@ParametricNullness E fromElement) { + public @PolyMutable SortedSet tailSet(@PolyMutable DescendingSet this, @ParametricNullness E fromElement) { return standardTailSet(fromElement); } @SuppressWarnings("unchecked") @Override - public Comparator comparator() { + public Comparator comparator(@Readonly DescendingSet this) { Comparator forwardComparator = forward.comparator(); if (forwardComparator == null) { return (Comparator) Ordering.natural().reverse(); @@ -2105,41 +2123,41 @@ public Comparator comparator() { } // If we inline this, we get a javac error. - private static Ordering reverse(Comparator forward) { + private static Ordering reverse(Comparator forward) { return Ordering.from(forward).reverse(); } @Override @ParametricNullness - public E first() { + public E first(@Readonly DescendingSet this) { return forward.last(); } @Override @ParametricNullness - public E last() { + public E last(@Readonly DescendingSet this) { return forward.first(); } @Override - public Iterator iterator() { + public Iterator iterator(@PolyMutable DescendingSet this) { return forward.descendingIterator(); } @Override @SuppressWarnings("nullness:return") - public @PolyNull @PolySigned Object[] toArray(Sets.DescendingSet<@PolyNull @PolySigned E> this) { + public @PolyNull @PolySigned @PolyMutable Object[] toArray(Sets.DescendingSet<@PolyNull @PolySigned @PolyMutable E> this) { return standardToArray(); } @Override @SuppressWarnings("nullness:return") - public T[] toArray(@PolyNull T[] array) { + public T[] toArray(@PolyNull T[] array) { return standardToArray(array); } @Override - public String toString() { + public String toString(@Readonly DescendingSet this) { return standardToString(); } } @@ -2162,8 +2180,8 @@ public String toString() { */ @Beta @GwtIncompatible // NavigableSet - public static > NavigableSet subSet( - NavigableSet set, Range range) { + public static > @PolyMutable NavigableSet subSet( + @PolyMutable NavigableSet set, Range range) { if (set.comparator() != null && set.comparator() != Ordering.natural() && range.hasLowerBound() diff --git a/guava/src/com/google/common/collect/SingletonImmutableBiMap.java b/guava/src/com/google/common/collect/SingletonImmutableBiMap.java index fdc6d3d9bbdd..5433f573c008 100644 --- a/guava/src/com/google/common/collect/SingletonImmutableBiMap.java +++ b/guava/src/com/google/common/collect/SingletonImmutableBiMap.java @@ -25,7 +25,12 @@ import java.util.function.BiConsumer; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * Implementation of {@link ImmutableMap} with exactly one entry. @@ -33,10 +38,12 @@ * @author Jesse Wilson * @author Kevin Bourrillion */ +@AnnotatedFor("pico") @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization @ElementTypesAreNonnullByDefault -final class SingletonImmutableBiMap extends ImmutableBiMap { +@Immutable +final class SingletonImmutableBiMap extends ImmutableBiMap { final transient K singleKey; final transient V singleValue; @@ -56,7 +63,7 @@ private SingletonImmutableBiMap(K singleKey, V singleValue, ImmutableBiMap @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { return singleKey.equals(key) ? singleValue : null; } @@ -71,12 +78,12 @@ public void forEach(BiConsumer action) { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return singleKey.equals(key); } @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@CheckForNull @UnknownSignedness @Readonly Object value) { return singleValue.equals(value); } @@ -96,7 +103,8 @@ ImmutableSet createKeySet() { } @CheckForNull private final transient ImmutableBiMap inverse; - @LazyInit @RetainedWith @CheckForNull private transient ImmutableBiMap lazyInverse; + @CFComment("Change to @LazyFinal later") + @LazyInit @RetainedWith @CheckForNull private transient @Assignable ImmutableBiMap lazyInverse; @Override public ImmutableBiMap inverse() { diff --git a/guava/src/com/google/common/collect/SingletonImmutableList.java b/guava/src/com/google/common/collect/SingletonImmutableList.java index cb99bb68de2c..d03e2c11d6a6 100644 --- a/guava/src/com/google/common/collect/SingletonImmutableList.java +++ b/guava/src/com/google/common/collect/SingletonImmutableList.java @@ -24,6 +24,8 @@ import java.util.Spliterator; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; @@ -34,10 +36,11 @@ * * @author Hayward Chan */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization @ElementTypesAreNonnullByDefault +@Immutable final class SingletonImmutableList extends ImmutableList { final transient E element; @@ -86,14 +89,14 @@ boolean isPartialView() { } @Pure -public boolean contains(@Nullable @UnknownSignedness Object arg0) { return super.contains(arg0); } +public boolean contains(@Nullable @UnknownSignedness @Readonly Object arg0) { return super.contains(arg0); } @Pure -public boolean equals(@Nullable @UnknownSignedness Object arg0) { return super.equals(arg0); } +public boolean equals(@Nullable @UnknownSignedness @Readonly Object arg0) { return super.equals(arg0); } @Pure -public int indexOf(@Nullable @UnknownSignedness Object arg0) { return super.indexOf(arg0); } +public int indexOf(@Nullable @UnknownSignedness @Readonly Object arg0) { return super.indexOf(arg0); } @Pure -public int lastIndexOf(@Nullable @UnknownSignedness Object arg0) { return super.lastIndexOf(arg0); } +public int lastIndexOf(@Nullable @UnknownSignedness @Readonly Object arg0) { return super.lastIndexOf(arg0); } } diff --git a/guava/src/com/google/common/collect/SingletonImmutableSet.java b/guava/src/com/google/common/collect/SingletonImmutableSet.java index 50bdde7afcfd..0e26e435f7ec 100644 --- a/guava/src/com/google/common/collect/SingletonImmutableSet.java +++ b/guava/src/com/google/common/collect/SingletonImmutableSet.java @@ -26,6 +26,8 @@ import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; /** * Implementation of {@link ImmutableSet} with exactly one element. @@ -33,10 +35,11 @@ * @author Kevin Bourrillion * @author Nick Kralevich */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization @ElementTypesAreNonnullByDefault +@Immutable final class SingletonImmutableSet extends ImmutableSet { // We deliberately avoid caching the asList and hashCode here, to ensure that with // compressed oops, a SingletonImmutableSet packs all the way down to the optimal 16 bytes. @@ -55,7 +58,7 @@ final class SingletonImmutableSet extends ImmutableSet { @Pure @Override - public boolean contains(@CheckForNull @UnknownSignedness Object target) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object target) { return element.equals(target); } @@ -75,7 +78,7 @@ boolean isPartialView() { } @Override - int copyIntoArray(@Nullable Object[] dst, int offset) { + int copyIntoArray(@Nullable @Readonly Object[] dst, int offset) { dst[offset] = element; return offset + 1; } @@ -93,5 +96,5 @@ public String toString() { } @Pure -public boolean equals(@Nullable @UnknownSignedness Object arg0) { return super.equals(arg0); } +public boolean equals(@Nullable @UnknownSignedness @Readonly Object arg0) { return super.equals(arg0); } } diff --git a/guava/src/com/google/common/collect/SingletonImmutableTable.java b/guava/src/com/google/common/collect/SingletonImmutableTable.java index cfaeadb41df7..3be72b2f63e7 100644 --- a/guava/src/com/google/common/collect/SingletonImmutableTable.java +++ b/guava/src/com/google/common/collect/SingletonImmutableTable.java @@ -21,14 +21,21 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; + /** * An implementation of {@link ImmutableTable} that holds a single cell. * * @author Gregory Kick */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -class SingletonImmutableTable extends ImmutableTable { +@CFComment("Value need to be immutable because it is later used for constructing a bimap") +@Immutable +class SingletonImmutableTable extends ImmutableTable { final R singleRowKey; final C singleColumnKey; final V singleValue; diff --git a/guava/src/com/google/common/collect/SortedIterable.java b/guava/src/com/google/common/collect/SortedIterable.java index 64ec08ef315b..5bb460e23e7a 100644 --- a/guava/src/com/google/common/collect/SortedIterable.java +++ b/guava/src/com/google/common/collect/SortedIterable.java @@ -18,6 +18,9 @@ import java.util.Comparator; import java.util.Iterator; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.framework.qual.AnnotatedFor; /** * An {@code Iterable} whose elements are sorted relative to a {@code Comparator}, typically @@ -25,9 +28,11 @@ * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -interface SortedIterable extends Iterable { +@ReceiverDependentMutable +interface SortedIterable extends Iterable { /** * Returns the {@code Comparator} by which the elements of this iterable are ordered, or {@code * Ordering.natural()} if the elements are ordered by their natural ordering. diff --git a/guava/src/com/google/common/collect/SortedIterables.java b/guava/src/com/google/common/collect/SortedIterables.java index 68b231a381e5..4e06a7ec09d1 100644 --- a/guava/src/com/google/common/collect/SortedIterables.java +++ b/guava/src/com/google/common/collect/SortedIterables.java @@ -20,6 +20,7 @@ import java.util.Comparator; import java.util.SortedSet; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; /** * Utilities for dealing with sorted collections of all types. @@ -51,7 +52,7 @@ public static boolean hasSameComparator(Comparator comparator, Iterable el @SuppressWarnings("unchecked") // if sortedSet.comparator() is null, the set must be naturally ordered - public static Comparator comparator( + public static Comparator comparator( SortedSet sortedSet) { Comparator result = sortedSet.comparator(); if (result == null) { diff --git a/guava/src/com/google/common/collect/SortedLists.java b/guava/src/com/google/common/collect/SortedLists.java index 0ebaab20f938..ab2964f101d0 100644 --- a/guava/src/com/google/common/collect/SortedLists.java +++ b/guava/src/com/google/common/collect/SortedLists.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.RandomAccess; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; /** * Static methods pertaining to sorted {@link List} instances. @@ -233,7 +234,7 @@ public static int binarySearch( * KeyAbsentBehavior)} using {@link Lists#transform(List, Function) Lists.transform(list, * keyFunction)}. */ - public static int binarySearch( + public static int binarySearch( List list, Function keyFunction, @ParametricNullness K key, diff --git a/guava/src/com/google/common/collect/SortedMapDifference.java b/guava/src/com/google/common/collect/SortedMapDifference.java index 46cac8a3da54..b7bb91219e31 100644 --- a/guava/src/com/google/common/collect/SortedMapDifference.java +++ b/guava/src/com/google/common/collect/SortedMapDifference.java @@ -19,6 +19,8 @@ import com.google.common.annotations.GwtCompatible; import java.util.SortedMap; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; /** * An object representing the differences between two sorted maps. @@ -28,7 +30,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -public interface SortedMapDifference +public interface SortedMapDifference extends MapDifference { @Override diff --git a/guava/src/com/google/common/collect/SortedMultiset.java b/guava/src/com/google/common/collect/SortedMultiset.java index 7cc512d8ee2e..504a286055fe 100644 --- a/guava/src/com/google/common/collect/SortedMultiset.java +++ b/guava/src/com/google/common/collect/SortedMultiset.java @@ -24,6 +24,8 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * A {@link Multiset} which maintains the ordering of its elements, according to either their @@ -44,7 +46,8 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -public interface SortedMultiset +@ReceiverDependentMutable +public interface SortedMultiset extends SortedMultisetBridge, SortedIterable { /** * Returns the comparator that orders this multiset, or {@link Ordering#natural()} if the natural diff --git a/guava/src/com/google/common/collect/SortedMultisetBridge.java b/guava/src/com/google/common/collect/SortedMultisetBridge.java index 72d50beb692f..5aa57385e882 100644 --- a/guava/src/com/google/common/collect/SortedMultisetBridge.java +++ b/guava/src/com/google/common/collect/SortedMultisetBridge.java @@ -19,6 +19,8 @@ import com.google.common.annotations.GwtIncompatible; import java.util.SortedSet; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * Superinterface of {@link SortedMultiset} to introduce a bridge method for {@code elementSet()}, @@ -29,7 +31,8 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault -interface SortedMultisetBridge extends Multiset { +@ReceiverDependentMutable +interface SortedMultisetBridge extends Multiset { @Override SortedSet elementSet(); } diff --git a/guava/src/com/google/common/collect/SortedMultisets.java b/guava/src/com/google/common/collect/SortedMultisets.java index f602a42a1145..c2c79d49b512 100644 --- a/guava/src/com/google/common/collect/SortedMultisets.java +++ b/guava/src/com/google/common/collect/SortedMultisets.java @@ -30,6 +30,8 @@ import java.util.SortedSet; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * Provides static utility methods for creating and working with {@link SortedMultiset} instances. @@ -43,7 +45,8 @@ private SortedMultisets() {} /** A skeleton implementation for {@link SortedMultiset#elementSet}. */ @SuppressWarnings("JdkObsolete") // TODO(b/6160855): Switch GWT emulations to NavigableSet. - static class ElementSet extends Multisets.ElementSet + @ReceiverDependentMutable + static class ElementSet extends Multisets.ElementSet implements SortedSet { @Weak private final SortedMultiset multiset; @@ -96,7 +99,8 @@ public E last() { /** A skeleton navigable implementation for {@link SortedMultiset#elementSet}. */ @GwtIncompatible // Navigable - static class NavigableElementSet extends ElementSet + @ReceiverDependentMutable + static class NavigableElementSet extends ElementSet implements NavigableSet { NavigableElementSet(SortedMultiset multiset) { super(multiset); @@ -182,7 +186,7 @@ public NavigableSet tailSet(@ParametricNullness E fromElement, boolean inclus } @CheckForNull - private static E getElementOrNull(@CheckForNull Entry entry) { + private static E getElementOrNull(@CheckForNull Entry entry) { return (entry == null) ? null : entry.getElement(); } } diff --git a/guava/src/com/google/common/collect/SortedSetMultimap.java b/guava/src/com/google/common/collect/SortedSetMultimap.java index f06d0f705307..e209519c01c9 100644 --- a/guava/src/com/google/common/collect/SortedSetMultimap.java +++ b/guava/src/com/google/common/collect/SortedSetMultimap.java @@ -26,6 +26,10 @@ import java.util.SortedSet; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.framework.qual.AnnotatedFor; /** @@ -52,7 +56,8 @@ @GwtCompatible @AnnotatedFor({"nullness"}) @ElementTypesAreNonnullByDefault -public interface SortedSetMultimap +@ReceiverDependentMutable +public interface SortedSetMultimap extends SetMultimap { // Following Javadoc copied from Multimap. @@ -67,7 +72,7 @@ public interface SortedSetMultimap get(@ParametricNullness K key); + SortedSet get(@Readonly SortedSetMultimap this, @ParametricNullness K key); /** * Removes all values associated with a given key. @@ -78,7 +83,7 @@ public interface SortedSetMultimap removeAll(@CheckForNull Object key); + SortedSet removeAll(@Mutable SortedSetMultimap this, @CheckForNull @Readonly Object key); /** * Stores a collection of values with the same key, replacing any existing values for that key. @@ -91,7 +96,7 @@ public interface SortedSetMultimap replaceValues(@ParametricNullness K key, Iterable values); + SortedSet replaceValues(@Mutable SortedSetMultimap this, @ParametricNullness K key, Iterable values); /** * Returns a map view that associates each key with the corresponding values in the multimap. diff --git a/guava/src/com/google/common/collect/SparseImmutableTable.java b/guava/src/com/google/common/collect/SparseImmutableTable.java index 44881fde7f73..3caa9c004594 100644 --- a/guava/src/com/google/common/collect/SparseImmutableTable.java +++ b/guava/src/com/google/common/collect/SparseImmutableTable.java @@ -17,19 +17,24 @@ import static java.util.Objects.requireNonNull; import com.google.common.annotations.GwtCompatible; -import com.google.errorprone.annotations.Immutable; +//import com.google.errorprone.annotations.Immutable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.framework.qual.AnnotatedFor; + import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; /** A {@code RegularImmutableTable} optimized for sparse data. */ @GwtCompatible -@Immutable(containerOf = {"R", "C", "V"}) +//@Immutable(containerOf = {"R", "C", "V"}) @ElementTypesAreNonnullByDefault -final class SparseImmutableTable extends RegularImmutableTable { - static final ImmutableTable EMPTY = +@AnnotatedFor("pico") +@Immutable +final class SparseImmutableTable extends RegularImmutableTable { + static final ImmutableTable<@Immutable Object, @Immutable Object, @Immutable Object> EMPTY = new SparseImmutableTable<>( - ImmutableList.>of(), ImmutableSet.of(), ImmutableSet.of()); + ImmutableList.>of(), ImmutableSet.of(), ImmutableSet.of()); private final ImmutableMap> rowMap; private final ImmutableMap> columnMap; diff --git a/guava/src/com/google/common/collect/StandardRowSortedTable.java b/guava/src/com/google/common/collect/StandardRowSortedTable.java index 91c223d363b8..2585bf63d54e 100644 --- a/guava/src/com/google/common/collect/StandardRowSortedTable.java +++ b/guava/src/com/google/common/collect/StandardRowSortedTable.java @@ -28,6 +28,8 @@ import java.util.SortedSet; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.KeyFor; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * Implementation of {@code Table} whose iteration ordering across row keys is sorted by their @@ -48,7 +50,8 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -class StandardRowSortedTable extends StandardTable +@ReceiverDependentMutable +class StandardRowSortedTable extends StandardTable implements RowSortedTable { /* * TODO(jlevy): Consider adding headTable, tailTable, and subTable methods, diff --git a/guava/src/com/google/common/collect/StandardTable.java b/guava/src/com/google/common/collect/StandardTable.java index 175b92bdc385..8060edc39fdb 100644 --- a/guava/src/com/google/common/collect/StandardTable.java +++ b/guava/src/com/google/common/collect/StandardTable.java @@ -47,7 +47,14 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.KeyFor; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.CFComment; /** * {@link Table} implementation backed by a map that associates row keys with column key / value @@ -70,11 +77,12 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -class StandardTable extends AbstractTable implements Serializable { +@ReceiverDependentMutable +class StandardTable extends AbstractTable implements Serializable { @GwtTransient final Map> backingMap; @GwtTransient final Supplier> factory; - StandardTable(Map> backingMap, Supplier> factory) { + StandardTable(@ReceiverDependentMutable Map> backingMap, @ReceiverDependentMutable Supplier> factory) { this.backingMap = backingMap; this.factory = factory; } @@ -82,12 +90,12 @@ class StandardTable extends AbstractTable implements Serializa // Accessors @Override - public boolean contains(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public boolean contains(@Readonly StandardTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { return rowKey != null && columnKey != null && super.contains(rowKey, columnKey); } @Override - public boolean containsColumn(@CheckForNull Object columnKey) { + public boolean containsColumn(@Readonly StandardTable this, @Readonly @CheckForNull Object columnKey) { if (columnKey == null) { return false; } @@ -100,28 +108,28 @@ public boolean containsColumn(@CheckForNull Object columnKey) { } @Override - public boolean containsRow(@CheckForNull Object rowKey) { + public boolean containsRow(@Readonly StandardTable this, @CheckForNull @Readonly Object rowKey) { return rowKey != null && safeContainsKey(backingMap, rowKey); } @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly StandardTable this, @CheckForNull @UnknownSignedness @Readonly Object value) { return value != null && super.containsValue(value); } @Override @CheckForNull - public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V get(@Readonly StandardTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { return (rowKey == null || columnKey == null) ? null : super.get(rowKey, columnKey); } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly StandardTable this) { return backingMap.isEmpty(); } @Override - public int size() { + public int size(@Readonly StandardTable this) { int size = 0; for (Map map : backingMap.values()) { size += map.size(); @@ -132,11 +140,11 @@ public int size() { // Mutators @Override - public void clear() { + public void clear(@Mutable StandardTable this) { backingMap.clear(); } - private Map getOrCreate(R rowKey) { + private Map getOrCreate(@Mutable StandardTable this, R rowKey) { Map map = backingMap.get(rowKey); if (map == null) { map = factory.get(); @@ -148,7 +156,7 @@ private Map getOrCreate(R rowKey) { @CanIgnoreReturnValue @Override @CheckForNull - public V put(R rowKey, C columnKey, V value) { + public V put(@Mutable StandardTable this, R rowKey, C columnKey, V value) { checkNotNull(rowKey); checkNotNull(columnKey); checkNotNull(value); @@ -158,7 +166,7 @@ public V put(R rowKey, C columnKey, V value) { @CanIgnoreReturnValue @Override @CheckForNull - public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V remove(@Mutable StandardTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { if ((rowKey == null) || (columnKey == null)) { return null; } @@ -174,7 +182,7 @@ public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { } @CanIgnoreReturnValue - private Map removeColumn(@CheckForNull Object column) { + private Map removeColumn(@Mutable StandardTable this, @CheckForNull @Readonly Object column) { Map output = new LinkedHashMap<>(); Iterator>> iterator = backingMap.entrySet().iterator(); while (iterator.hasNext()) { @@ -190,14 +198,14 @@ private Map removeColumn(@CheckForNull Object column) { return output; } - private boolean containsMapping( - @CheckForNull Object rowKey, @CheckForNull Object columnKey, @CheckForNull Object value) { + private boolean containsMapping(@Readonly StandardTable this, + @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey, @CheckForNull @Readonly Object value) { return value != null && value.equals(get(rowKey, columnKey)); } /** Remove a row key / column key / value mapping, if present. */ - private boolean removeMapping( - @CheckForNull Object rowKey, @CheckForNull Object columnKey, @CheckForNull Object value) { + private boolean removeMapping(@Mutable StandardTable this, + @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey, @CheckForNull @Readonly Object value) { if (containsMapping(rowKey, columnKey, value)) { remove(rowKey, columnKey); return true; @@ -212,14 +220,15 @@ private boolean removeMapping( * clear()} clears all table mappings. */ @WeakOuter + @ReceiverDependentMutable private abstract class TableSet extends ImprovedAbstractSet { @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly TableSet this) { return backingMap.isEmpty(); } @Override - public void clear() { + public void clear(@Mutable TableSet this) { backingMap.clear(); } } @@ -234,27 +243,28 @@ public void clear() { * time the cell is returned by a method call to the set or its iterator. */ @Override - public Set> cellSet() { + public @PolyMutable Set> cellSet(@PolyMutable StandardTable this) { return super.cellSet(); } @Override - Iterator> cellIterator() { + Iterator> cellIterator(@Readonly StandardTable this) { return new CellIterator(); } + @ReceiverDependentMutable private class CellIterator implements Iterator> { final Iterator>> rowIterator = backingMap.entrySet().iterator(); @CheckForNull Entry> rowEntry; Iterator> columnIterator = Iterators.emptyModifiableIterator(); @Override - public boolean hasNext() { + public boolean hasNext(@Readonly CellIterator this) { return rowIterator.hasNext() || columnIterator.hasNext(); } @Override - public Cell next() { + public Cell next(@Mutable CellIterator this) { if (!columnIterator.hasNext()) { rowEntry = rowIterator.next(); columnIterator = rowEntry.getValue().entrySet().iterator(); @@ -278,7 +288,7 @@ public Cell next() { } @Override - public void remove() { + public void remove(@Mutable CellIterator this) { columnIterator.remove(); /* * requireNonNull is safe because: @@ -298,7 +308,7 @@ public void remove() { } @Override - Spliterator> cellSpliterator() { + Spliterator> cellSpliterator(@Readonly StandardTable this) { return CollectSpliterators.flatMap( backingMap.entrySet().spliterator(), (Entry> rowEntry) -> @@ -316,6 +326,7 @@ public Map row(R rowKey) { return new Row(rowKey); } + @ReceiverDependentMutable class Row extends IteratorBasedAbstractMap { final R rowKey; @@ -346,14 +357,14 @@ void maintainEmptyInvariant() { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { updateBackingRowMapField(); return (key != null && backingRowMap != null) && Maps.safeContainsKey(backingRowMap, key); } @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { updateBackingRowMapField(); return (key != null && backingRowMap != null) ? Maps.safeGet(backingRowMap, key) : null; } @@ -371,7 +382,7 @@ public V put(C key, V value) { @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@CheckForNull @UnknownSignedness @Readonly Object key) { updateBackingRowMapField(); if (backingRowMap == null) { return null; @@ -462,6 +473,7 @@ public Map column(C columnKey) { return new Column(columnKey); } + @ReceiverDependentMutable private class Column extends ViewCachingAbstractMap { final C columnKey; @@ -477,18 +489,18 @@ public V put(R key, V value) { @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { return StandardTable.this.get(key, columnKey); } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return StandardTable.this.contains(key, columnKey); } @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@Mutable Column this, @CheckForNull @UnknownSignedness @Readonly Object key) { return StandardTable.this.remove(key, columnKey); } @@ -546,7 +558,7 @@ public void clear() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object o) { if (o instanceof Entry) { Entry entry = (Entry) o; return containsMapping(entry.getKey(), columnKey, entry.getValue()); @@ -555,7 +567,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object o) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object obj) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object obj) { if (obj instanceof Entry) { Entry entry = (Entry) obj; return removeMapping(entry.getKey(), columnKey, entry.getValue()); @@ -629,12 +641,12 @@ private class KeySet extends Maps.KeySet { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object obj) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object obj) { return StandardTable.this.contains(obj, columnKey); } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object obj) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object obj) { return StandardTable.this.remove(obj, columnKey) != null; } @@ -656,7 +668,7 @@ private class Values extends Maps.Values { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object obj) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object obj) { return obj != null && removeFromColumnIf(Maps.valuePredicateOnEntries(equalTo(obj))); } @@ -673,11 +685,12 @@ public boolean retainAll(final Collection c) { } @Override - public Set rowKeySet() { + public @PolyMutable Set rowKeySet(@PolyMutable StandardTable this) { return rowMap().keySet(); } - @CheckForNull private transient Set columnKeySet; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable Set columnKeySet; /** * {@inheritDoc} @@ -694,6 +707,7 @@ public Set columnKeySet() { } @WeakOuter + @ReceiverDependentMutable private class ColumnKeySet extends TableSet { @Override public Iterator iterator() { @@ -706,7 +720,7 @@ public Iterator iterator() { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object obj) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object obj) { if (obj == null) { return false; } @@ -761,7 +775,7 @@ public boolean retainAll(Collection c) { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object obj) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object obj) { return containsColumn(obj); } } @@ -771,6 +785,7 @@ Iterator createColumnKeyIterator() { return new ColumnKeyIterator(); } + @ReceiverDependentMutable private class ColumnKeyIterator extends AbstractIterator { // Use the same map type to support TreeMaps with comparators that aren't // consistent with equals(). @@ -804,14 +819,15 @@ protected C computeNext() { * row, and so on. */ @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable StandardTable this) { return super.values(); } - @CheckForNull private transient Map> rowMap; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable Map> rowMap; @Override - public Map> rowMap() { + public @PolyMutable Map> rowMap(@PolyMutable StandardTable this) { Map> result = rowMap; return (result == null) ? rowMap = createRowMap() : result; } @@ -821,9 +837,10 @@ Map> createRowMap() { } @WeakOuter + @ReceiverDependentMutable class RowMap extends ViewCachingAbstractMap> { @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return containsRow(key); } @@ -831,14 +848,14 @@ public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { @SuppressWarnings("unchecked") @Override @CheckForNull - public Map get(@CheckForNull @UnknownSignedness Object key) { + public Map get(@CheckForNull @UnknownSignedness @Readonly Object key) { // requireNonNull is safe because of the containsRow check. return containsRow(key) ? row((R) requireNonNull(key)) : null; } @Override @CheckForNull - public Map remove(@CheckForNull @UnknownSignedness Object key) { + public Map remove(@CheckForNull @UnknownSignedness @Readonly Object key) { return (key == null) ? null : backingMap.remove(key); } @@ -867,7 +884,7 @@ public Map apply(R rowKey) { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object obj) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object obj) { if (obj instanceof Entry) { Entry entry = (Entry) obj; return entry.getKey() != null @@ -878,7 +895,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object obj) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object obj) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object obj) { if (obj instanceof Entry) { Entry entry = (Entry) obj; return entry.getKey() != null @@ -890,34 +907,36 @@ public boolean remove(@CheckForNull @UnknownSignedness Object obj) { } } - @CheckForNull private transient ColumnMap columnMap; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable ColumnMap columnMap; @Override - public Map> columnMap() { + public @PolyMutable Map> columnMap(@PolyMutable StandardTable this) { ColumnMap result = columnMap; return (result == null) ? columnMap = new ColumnMap() : result; } @WeakOuter + @ReceiverDependentMutable private class ColumnMap extends ViewCachingAbstractMap> { // The cast to C occurs only when the key is in the map, implying that it // has the correct type. @SuppressWarnings("unchecked") @Override @CheckForNull - public Map get(@CheckForNull @UnknownSignedness Object key) { + public Map get(@CheckForNull @UnknownSignedness @Readonly Object key) { // requireNonNull is safe because of the containsColumn check. return containsColumn(key) ? column((C) requireNonNull(key)) : null; } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return containsColumn(key); } @Override @CheckForNull - public Map remove(@CheckForNull @UnknownSignedness Object key) { + public Map remove(@CheckForNull @UnknownSignedness @Readonly Object key) { return containsColumn(key) ? removeColumn(key) : null; } @@ -968,7 +987,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object obj) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object obj) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object obj) { /* * `o instanceof Entry` is guaranteed by `contains`, but we check it here to satisfy our * nullness checker. @@ -1014,7 +1033,7 @@ private class ColumnMapValues extends Maps.Values> { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object obj) { + public boolean remove(@CheckForNull @UnknownSignedness @Readonly Object obj) { for (Entry> entry : ColumnMap.this.entrySet()) { if (entry.getValue().equals(obj)) { removeColumn(entry.getKey()); diff --git a/guava/src/com/google/common/collect/Streams.java b/guava/src/com/google/common/collect/Streams.java index cd7a07c34219..9bd9a75324bd 100644 --- a/guava/src/com/google/common/collect/Streams.java +++ b/guava/src/com/google/common/collect/Streams.java @@ -50,6 +50,7 @@ import java.util.stream.StreamSupport; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; /** * Static utility methods related to {@code Stream} instances. @@ -63,7 +64,7 @@ public final class Streams { * Returns a sequential {@link Stream} of the contents of {@code iterable}, delegating to {@link * Collection#stream} if possible. */ - public static Stream stream(Iterable iterable) { + public static Stream stream(Iterable iterable) { return (iterable instanceof Collection) ? ((Collection) iterable).stream() : StreamSupport.stream(iterable.spliterator(), false); @@ -77,7 +78,7 @@ public final class Streams { @Beta @Deprecated @InlineMe(replacement = "collection.stream()") - public static Stream stream(Collection collection) { + public static Stream stream(Collection collection) { return collection.stream(); } @@ -86,7 +87,7 @@ public final class Streams { * {@code iterator} directly after passing it to this method. */ @Beta - public static Stream stream(Iterator iterator) { + public static Stream stream(Iterator iterator) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false); } @@ -168,7 +169,7 @@ private static void closeAll(BaseStream[] toClose) { * @see Stream#concat(Stream, Stream) */ @SafeVarargs - public static Stream concat(Stream... streams) { + public static Stream concat(Stream... streams) { // TODO(lowasser): consider an implementation that can support SUBSIZED boolean isParallel = false; int characteristics = Spliterator.ORDERED | Spliterator.SIZED | Spliterator.NONNULL; @@ -314,7 +315,7 @@ public static DoubleStream concat(DoubleStream... streams) { * This may harm parallel performance. */ @Beta - public static + public static Stream zip( Stream streamA, Stream streamB, BiFunction function) { checkNotNull(streamA); @@ -377,7 +378,7 @@ public boolean tryAdvance(Consumer action) { * @since 22.0 */ @Beta - public static void forEachPair( + public static void forEachPair( Stream streamA, Stream streamB, BiConsumer consumer) { checkNotNull(consumer); @@ -393,7 +394,7 @@ public boolean tryAdvance(Consumer action) { } // Use this carefully - it doesn't implement value semantics - private static class TemporaryPair { + private static class TemporaryPair { @ParametricNullness final A a; @ParametricNullness final B b; @@ -425,7 +426,7 @@ private static class TemporaryPairThe order of the resulting stream is defined if and only if the order of the original stream * was defined. */ - public static Stream mapWithIndex( + public static Stream mapWithIndex( Stream stream, FunctionWithIndex function) { checkNotNull(stream); checkNotNull(function); @@ -508,7 +509,7 @@ Splitr createSplit(Spliterator from, long i) { *

The order of the resulting stream is defined if and only if the order of the original stream * was defined. */ - public static Stream mapWithIndex( + public static Stream mapWithIndex( IntStream stream, IntFunctionWithIndex function) { checkNotNull(stream); checkNotNull(function); @@ -587,7 +588,7 @@ Splitr createSplit(Spliterator.OfInt from, long i) { *

The order of the resulting stream is defined if and only if the order of the original stream * was defined. */ - public static Stream mapWithIndex( + public static Stream mapWithIndex( LongStream stream, LongFunctionWithIndex function) { checkNotNull(stream); checkNotNull(function); @@ -666,7 +667,7 @@ Splitr createSplit(Spliterator.OfLong from, long i) { *

The order of the resulting stream is defined if and only if the order of the original stream * was defined. */ - public static Stream mapWithIndex( + public static Stream mapWithIndex( DoubleStream stream, DoubleFunctionWithIndex function) { checkNotNull(stream); checkNotNull(function); @@ -731,16 +732,16 @@ Splitr createSplit(Spliterator.OfDouble from, long i) { * * @since 21.0 */ - public interface FunctionWithIndex { + public interface FunctionWithIndex { /** Applies this function to the given argument and its index within a stream. */ @ParametricNullness R apply(@ParametricNullness T from, long index); } private abstract static class MapWithIndexSpliterator< - F extends Spliterator, - R extends @Nullable Object, - S extends MapWithIndexSpliterator> + F extends @Readonly Spliterator, + R extends @Nullable @Readonly Object, + S extends @Readonly MapWithIndexSpliterator> implements Spliterator { final F fromSpliterator; long index; @@ -786,7 +787,7 @@ public int characteristics() { * * @since 21.0 */ - public interface IntFunctionWithIndex { + public interface IntFunctionWithIndex { /** Applies this function to the given argument and its index within a stream. */ @ParametricNullness R apply(int from, long index); @@ -800,7 +801,7 @@ public interface IntFunctionWithIndex { * * @since 21.0 */ - public interface LongFunctionWithIndex { + public interface LongFunctionWithIndex { /** Applies this function to the given argument and its index within a stream. */ @ParametricNullness R apply(long from, long index); @@ -814,7 +815,7 @@ public interface LongFunctionWithIndex { * * @since 21.0 */ - public interface DoubleFunctionWithIndex { + public interface DoubleFunctionWithIndex { /** Applies this function to the given argument and its index within a stream. */ @ParametricNullness R apply(double from, long index); diff --git a/guava/src/com/google/common/collect/Synchronized.java b/guava/src/com/google/common/collect/Synchronized.java index 2fbec1c64a9e..86717fe77378 100644 --- a/guava/src/com/google/common/collect/Synchronized.java +++ b/guava/src/com/google/common/collect/Synchronized.java @@ -52,6 +52,11 @@ import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; @@ -85,16 +90,17 @@ final class Synchronized { private Synchronized() {} + @ReceiverDependentMutable static class SynchronizedObject implements Serializable { final Object delegate; - final Object mutex; + final @Readonly Object mutex; - SynchronizedObject(Object delegate, @CheckForNull Object mutex) { + SynchronizedObject(@ReceiverDependentMutable Object delegate, @CheckForNull @Readonly Object mutex) { this.delegate = checkNotNull(delegate); this.mutex = (mutex == null) ? this : mutex; } - Object delegate() { + @PolyMutable Object delegate(@PolyMutable SynchronizedObject this) { return delegate; } @@ -102,7 +108,7 @@ Object delegate() { @Pure @Override - public String toString() { + public String toString(@Readonly SynchronizedObject this) { synchronized (mutex) { return delegate.toString(); } @@ -124,40 +130,41 @@ private void writeObject(ObjectOutputStream stream) throws IOException { private static final long serialVersionUID = 0; } - private static Collection collection( - Collection collection, @CheckForNull Object mutex) { + private static Collection collection( + Collection collection, @CheckForNull @Readonly Object mutex) { return new SynchronizedCollection(collection, mutex); } @VisibleForTesting - static class SynchronizedCollection extends SynchronizedObject + @ReceiverDependentMutable + static class SynchronizedCollection extends SynchronizedObject implements Collection { - private SynchronizedCollection(Collection delegate, @CheckForNull Object mutex) { + private SynchronizedCollection(@ReceiverDependentMutable Collection delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @SuppressWarnings("unchecked") @Override - Collection delegate() { - return (Collection) super.delegate(); + @PolyMutable Collection delegate(@PolyMutable SynchronizedCollection this) { + return (@PolyMutable Collection) super.delegate(); } @Override - public boolean add(E e) { + public boolean add(@Mutable SynchronizedCollection this, E e) { synchronized (mutex) { return delegate().add(e); } } @Override - public boolean addAll(Collection c) { + public boolean addAll(@Mutable SynchronizedCollection this, @Readonly Collection c) { synchronized (mutex) { return delegate().addAll(c); } } @Override - public void clear() { + public void clear(@Mutable SynchronizedCollection this) { synchronized (mutex) { delegate().clear(); } @@ -165,7 +172,7 @@ public void clear() { @Pure @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly SynchronizedCollection this, @CheckForNull @UnknownSignedness @Readonly Object o) { synchronized (mutex) { return delegate().contains(o); } @@ -173,7 +180,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object o) { @Pure @Override - public boolean containsAll(Collection c) { + public boolean containsAll(@Readonly SynchronizedCollection this, @Readonly Collection c) { synchronized (mutex) { return delegate().containsAll(c); } @@ -181,33 +188,33 @@ public boolean containsAll(Collection c) { @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly SynchronizedCollection this) { synchronized (mutex) { return delegate().isEmpty(); } } @Override - public Iterator iterator() { + public Iterator iterator(@Readonly SynchronizedCollection this) { return delegate().iterator(); // manually synchronized } @Override - public Spliterator spliterator() { + public Spliterator spliterator(@Readonly SynchronizedCollection this) { synchronized (mutex) { return delegate().spliterator(); } } @Override - public Stream stream() { + public Stream stream(@Readonly SynchronizedCollection this) { synchronized (mutex) { return delegate().stream(); } } @Override - public Stream parallelStream() { + public Stream parallelStream(@Readonly SynchronizedCollection this) { synchronized (mutex) { return delegate().parallelStream(); } @@ -221,21 +228,21 @@ public void forEach(Consumer action) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable SynchronizedCollection this, @CheckForNull @UnknownSignedness @Readonly Object o) { synchronized (mutex) { return delegate().remove(o); } } @Override - public boolean removeAll(Collection c) { + public boolean removeAll(@Mutable SynchronizedCollection this, @Readonly Collection c) { synchronized (mutex) { return delegate().removeAll(c); } } @Override - public boolean retainAll(Collection c) { + public boolean retainAll(@Mutable SynchronizedCollection this, @Readonly Collection c) { synchronized (mutex) { return delegate().retainAll(c); } @@ -243,14 +250,14 @@ public boolean retainAll(Collection c) { @Pure @Override - public boolean removeIf(Predicate filter) { + public boolean removeIf(@Mutable SynchronizedCollection this, Predicate filter) { synchronized (mutex) { return delegate().removeIf(filter); } } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly SynchronizedCollection this) { synchronized (mutex) { return delegate().size(); } @@ -266,7 +273,7 @@ public boolean removeIf(Predicate filter) { @Override @SuppressWarnings("nullness:return") - public T[] toArray(@PolyNull T[] a) { + public T[] toArray(@PolyNull T[] a) { synchronized (mutex) { return delegate().toArray(a); } @@ -276,25 +283,26 @@ public boolean removeIf(Predicate filter) { } @VisibleForTesting - static Set set(Set set, @CheckForNull Object mutex) { - return new SynchronizedSet(set, mutex); + static @PolyMutable Set set(@PolyMutable Set set, @CheckForNull @Readonly Object mutex) { + return new @PolyMutable SynchronizedSet(set, mutex); } - static class SynchronizedSet extends SynchronizedCollection + @ReceiverDependentMutable + static class SynchronizedSet extends SynchronizedCollection implements Set { - SynchronizedSet(Set delegate, @CheckForNull Object mutex) { + SynchronizedSet(@ReceiverDependentMutable Set delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - Set delegate() { - return (Set) super.delegate(); + @PolyMutable Set delegate(@PolyMutable SynchronizedSet this) { + return (@PolyMutable Set) super.delegate(); } @Pure @Override - public boolean equals(@CheckForNull @UnknownSignedness Object o) { + public boolean equals(@Readonly SynchronizedSet this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (o == this) { return true; } @@ -305,7 +313,7 @@ public boolean equals(@CheckForNull @UnknownSignedness Object o) { @Pure @Override - public int hashCode(@UnknownSignedness SynchronizedSet this) { + public int hashCode(@UnknownSignedness @Readonly SynchronizedSet this) { synchronized (mutex) { return delegate().hashCode(); } @@ -314,20 +322,21 @@ public int hashCode(@UnknownSignedness SynchronizedSet this) { private static final long serialVersionUID = 0; } - private static SortedSet sortedSet( - SortedSet set, @CheckForNull Object mutex) { + private static SortedSet sortedSet( + SortedSet set, @CheckForNull @Readonly Object mutex) { return new SynchronizedSortedSet(set, mutex); } - static class SynchronizedSortedSet extends SynchronizedSet + @ReceiverDependentMutable + static class SynchronizedSortedSet extends SynchronizedSet implements SortedSet { - SynchronizedSortedSet(SortedSet delegate, @CheckForNull Object mutex) { + SynchronizedSortedSet(@ReceiverDependentMutable SortedSet delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - SortedSet delegate() { - return (SortedSet) super.delegate(); + @PolyMutable SortedSet delegate(@PolyMutable SynchronizedSortedSet this) { + return (@PolyMutable SortedSet) super.delegate(); } @SideEffectFree @@ -341,7 +350,7 @@ public Comparator comparator() { @SideEffectFree @Override - public SortedSet subSet(E fromElement, E toElement) { + public @PolyMutable SortedSet subSet(@PolyMutable SynchronizedSortedSet this, E fromElement, E toElement) { synchronized (mutex) { return sortedSet(delegate().subSet(fromElement, toElement), mutex); } @@ -349,7 +358,7 @@ public SortedSet subSet(E fromElement, E toElement) { @SideEffectFree @Override - public SortedSet headSet(E toElement) { + public @PolyMutable SortedSet headSet(@PolyMutable SynchronizedSortedSet this, E toElement) { synchronized (mutex) { return sortedSet(delegate().headSet(toElement), mutex); } @@ -357,7 +366,7 @@ public SortedSet headSet(E toElement) { @SideEffectFree @Override - public SortedSet tailSet(E fromElement) { + public @PolyMutable SortedSet tailSet(@PolyMutable SynchronizedSortedSet this, E fromElement) { synchronized (mutex) { return sortedSet(delegate().tailSet(fromElement), mutex); } @@ -365,7 +374,7 @@ public SortedSet tailSet(E fromElement) { @SideEffectFree @Override - public E first() { + public E first(@Readonly SynchronizedSortedSet this) { synchronized (mutex) { return delegate().first(); } @@ -373,7 +382,7 @@ public E first() { @SideEffectFree @Override - public E last() { + public E last(@Readonly SynchronizedSortedSet this) { synchronized (mutex) { return delegate().last(); } @@ -382,40 +391,41 @@ public E last() { private static final long serialVersionUID = 0; } - private static List list( - List list, @CheckForNull Object mutex) { + private static List list( + List list, @CheckForNull @Readonly Object mutex) { return (list instanceof RandomAccess) ? new SynchronizedRandomAccessList(list, mutex) : new SynchronizedList(list, mutex); } - private static class SynchronizedList + @ReceiverDependentMutable + private static class SynchronizedList extends SynchronizedCollection implements List { - SynchronizedList(List delegate, @CheckForNull Object mutex) { + SynchronizedList(@ReceiverDependentMutable List delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - List delegate() { + @PolyMutable List delegate(@PolyMutable SynchronizedList this) { return (List) super.delegate(); } @Override - public void add(int index, E element) { + public void add(@Mutable SynchronizedList this, int index, E element) { synchronized (mutex) { delegate().add(index, element); } } @Override - public boolean addAll(int index, Collection c) { + public boolean addAll(@Mutable SynchronizedList this, int index, @Readonly Collection c) { synchronized (mutex) { return delegate().addAll(index, c); } } @Override - public E get(int index) { + public E get(@Readonly SynchronizedList this, int index) { synchronized (mutex) { return delegate().get(index); } @@ -423,7 +433,7 @@ public E get(int index) { @Pure @Override - public int indexOf(@CheckForNull @UnknownSignedness Object o) { + public int indexOf(@Readonly SynchronizedList this, @CheckForNull @UnknownSignedness @Readonly Object o) { synchronized (mutex) { return delegate().indexOf(o); } @@ -431,31 +441,31 @@ public int indexOf(@CheckForNull @UnknownSignedness Object o) { @Pure @Override - public int lastIndexOf(@CheckForNull @UnknownSignedness Object o) { + public int lastIndexOf(@Readonly SynchronizedList this, @CheckForNull @UnknownSignedness @Readonly Object o) { synchronized (mutex) { return delegate().lastIndexOf(o); } } @Override - public ListIterator listIterator() { + public ListIterator listIterator(@Readonly SynchronizedList this) { return delegate().listIterator(); // manually synchronized } @Override - public ListIterator listIterator(int index) { + public ListIterator listIterator(@Readonly SynchronizedList this, int index) { return delegate().listIterator(index); // manually synchronized } @Override - public E remove(int index) { + public E remove(@Mutable SynchronizedList this, int index) { synchronized (mutex) { return delegate().remove(index); } } @Override - public E set(int index, E element) { + public E set(@Mutable SynchronizedList this, int index, E element) { synchronized (mutex) { return delegate().set(index, element); } @@ -463,21 +473,21 @@ public E set(int index, E element) { @SideEffectFree @Override - public void replaceAll(UnaryOperator operator) { + public void replaceAll(@Mutable SynchronizedList this, UnaryOperator operator) { synchronized (mutex) { delegate().replaceAll(operator); } } @Override - public void sort(Comparator c) { + public void sort(@Mutable SynchronizedList this, Comparator c) { synchronized (mutex) { delegate().sort(c); } } @Override - public List subList(int fromIndex, int toIndex) { + public @PolyMutable List subList(@PolyMutable SynchronizedList this, int fromIndex, int toIndex) { synchronized (mutex) { return list(delegate().subList(fromIndex, toIndex), mutex); } @@ -485,7 +495,7 @@ public List subList(int fromIndex, int toIndex) { @Pure @Override - public boolean equals(@CheckForNull @UnknownSignedness Object o) { + public boolean equals(@Readonly SynchronizedList this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (o == this) { return true; } @@ -496,7 +506,7 @@ public boolean equals(@CheckForNull @UnknownSignedness Object o) { @Pure @Override - public int hashCode(@UnknownSignedness SynchronizedList this) { + public int hashCode(@UnknownSignedness @Readonly SynchronizedList this) { synchronized (mutex) { return delegate().hashCode(); } @@ -505,67 +515,69 @@ public int hashCode(@UnknownSignedness SynchronizedList this) { private static final long serialVersionUID = 0; } - private static class SynchronizedRandomAccessList + @ReceiverDependentMutable + private static class SynchronizedRandomAccessList extends SynchronizedList implements RandomAccess { - SynchronizedRandomAccessList(List list, @CheckForNull Object mutex) { + SynchronizedRandomAccessList(@ReceiverDependentMutable List list, @CheckForNull @Readonly Object mutex) { super(list, mutex); } private static final long serialVersionUID = 0; } - static Multiset multiset( - Multiset multiset, @CheckForNull Object mutex) { + static Multiset multiset( + Multiset multiset, @CheckForNull @Readonly Object mutex) { if (multiset instanceof SynchronizedMultiset || multiset instanceof ImmutableMultiset) { return multiset; } return new SynchronizedMultiset(multiset, mutex); } - private static class SynchronizedMultiset + @ReceiverDependentMutable + private static class SynchronizedMultiset extends SynchronizedCollection implements Multiset { @CheckForNull transient Set elementSet; @CheckForNull transient Set> entrySet; - SynchronizedMultiset(Multiset delegate, @CheckForNull Object mutex) { + SynchronizedMultiset(@ReceiverDependentMutable Multiset delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - Multiset delegate() { + @PolyMutable Multiset delegate(@PolyMutable SynchronizedMultiset this) { return (Multiset) super.delegate(); } @Override - public @NonNegative int count(@CheckForNull @UnknownSignedness Object o) { + public @NonNegative int count(@Readonly SynchronizedMultiset this, @CheckForNull @UnknownSignedness @Readonly Object o) { synchronized (mutex) { return delegate().count(o); } } @Override - public int add(E e, int n) { + public int add(@Mutable SynchronizedMultiset this, E e, int n) { synchronized (mutex) { return delegate().add(e, n); } } @Override - public int remove(@CheckForNull Object o, int n) { + public int remove(@Mutable SynchronizedMultiset this, @CheckForNull @Readonly Object o, int n) { synchronized (mutex) { return delegate().remove(o, n); } } @Override - public int setCount(E element, int count) { + public int setCount(@Mutable SynchronizedMultiset this, E element, int count) { synchronized (mutex) { return delegate().setCount(element, count); } } @Override - public boolean setCount(E element, int oldCount, int newCount) { + public boolean setCount(@Mutable SynchronizedMultiset this, E element, int oldCount, int newCount) { synchronized (mutex) { return delegate().setCount(element, oldCount, newCount); } @@ -573,7 +585,7 @@ public boolean setCount(E element, int oldCount, int newCount) { @SideEffectFree @Override - public Set elementSet() { + public @PolyMutable Set elementSet(@PolyMutable SynchronizedMultiset this) { synchronized (mutex) { if (elementSet == null) { elementSet = typePreservingSet(delegate().elementSet(), mutex); @@ -584,7 +596,7 @@ public Set elementSet() { @SideEffectFree @Override - public Set> entrySet() { + public @PolyMutable Set> entrySet(@PolyMutable SynchronizedMultiset this) { synchronized (mutex) { if (entrySet == null) { entrySet = typePreservingSet(delegate().entrySet(), mutex); @@ -595,7 +607,7 @@ public Set> entrySet() { @Pure @Override - public boolean equals(@CheckForNull @UnknownSignedness Object o) { + public boolean equals(@Readonly SynchronizedMultiset this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (o == this) { return true; } @@ -606,7 +618,7 @@ public boolean equals(@CheckForNull @UnknownSignedness Object o) { @Pure @Override - public int hashCode(@UnknownSignedness SynchronizedMultiset this) { + public int hashCode(@UnknownSignedness @Readonly SynchronizedMultiset this) { synchronized (mutex) { return delegate().hashCode(); } @@ -615,15 +627,16 @@ public int hashCode(@UnknownSignedness SynchronizedMultiset this) { private static final long serialVersionUID = 0; } - static Multimap multimap( - Multimap multimap, @CheckForNull Object mutex) { + static Multimap multimap( + Multimap multimap, @CheckForNull @Readonly Object mutex) { if (multimap instanceof SynchronizedMultimap || multimap instanceof BaseImmutableMultimap) { return multimap; } return new SynchronizedMultimap<>(multimap, mutex); } - private static class SynchronizedMultimap + @ReceiverDependentMutable + private static class SynchronizedMultimap extends SynchronizedObject implements Multimap { @CheckForNull transient Set keySet; @CheckForNull transient Collection valuesCollection; @@ -633,17 +646,17 @@ private static class SynchronizedMultimap delegate() { + @PolyMutable Multimap delegate(@PolyMutable SynchronizedMultimap this) { return (Multimap) super.delegate(); } - SynchronizedMultimap(Multimap delegate, @CheckForNull Object mutex) { + SynchronizedMultimap(@ReceiverDependentMutable Multimap delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Pure @Override - public int size() { + public int size(@Readonly SynchronizedMultimap this) { synchronized (mutex) { return delegate().size(); } @@ -651,7 +664,7 @@ public int size() { @Pure @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly SynchronizedMultimap this) { synchronized (mutex) { return delegate().isEmpty(); } @@ -659,7 +672,7 @@ public boolean isEmpty() { @Pure @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly SynchronizedMultimap this, @CheckForNull @UnknownSignedness @Readonly Object key) { synchronized (mutex) { return delegate().containsKey(key); } @@ -667,7 +680,7 @@ public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { @Pure @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly SynchronizedMultimap this, @CheckForNull @UnknownSignedness @Readonly Object value) { synchronized (mutex) { return delegate().containsValue(value); } @@ -675,63 +688,63 @@ public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { @Pure @Override - public boolean containsEntry(@CheckForNull Object key, @CheckForNull Object value) { + public boolean containsEntry(@Readonly SynchronizedMultimap this, @CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { synchronized (mutex) { return delegate().containsEntry(key, value); } } @Override - public Collection get(K key) { + public Collection get(@Readonly SynchronizedMultimap this, K key) { synchronized (mutex) { return typePreservingCollection(delegate().get(key), mutex); } } @Override - public boolean put(K key, V value) { + public boolean put(@Mutable SynchronizedMultimap this, K key, V value) { synchronized (mutex) { return delegate().put(key, value); } } @Override - public boolean putAll(K key, Iterable values) { + public boolean putAll(@Mutable SynchronizedMultimap this, K key, Iterable values) { synchronized (mutex) { return delegate().putAll(key, values); } } @Override - public boolean putAll(Multimap multimap) { + public boolean putAll(@Mutable SynchronizedMultimap this, @Readonly Multimap multimap) { synchronized (mutex) { return delegate().putAll(multimap); } } @Override - public Collection replaceValues(K key, Iterable values) { + public Collection replaceValues(@Mutable SynchronizedMultimap this, K key, Iterable values) { synchronized (mutex) { return delegate().replaceValues(key, values); // copy not synchronized } } @Override - public boolean remove(@CheckForNull Object key, @CheckForNull Object value) { + public boolean remove(@Mutable SynchronizedMultimap this, @CheckForNull @Readonly Object key, @CheckForNull @Readonly Object value) { synchronized (mutex) { return delegate().remove(key, value); } } @Override - public Collection removeAll(@CheckForNull Object key) { + public Collection removeAll(@Mutable SynchronizedMultimap this, @CheckForNull @Readonly Object key) { synchronized (mutex) { return delegate().removeAll(key); // copy not synchronized } } @Override - public void clear() { + public void clear(@Mutable SynchronizedMultimap this) { synchronized (mutex) { delegate().clear(); } @@ -739,7 +752,7 @@ public void clear() { @SideEffectFree @Override - public Set keySet() { + public @PolyMutable Set keySet(@PolyMutable SynchronizedMultimap this) { synchronized (mutex) { if (keySet == null) { keySet = typePreservingSet(delegate().keySet(), mutex); @@ -750,7 +763,7 @@ public Set keySet() { @SideEffectFree @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable SynchronizedMultimap this) { synchronized (mutex) { if (valuesCollection == null) { valuesCollection = collection(delegate().values(), mutex); @@ -761,7 +774,7 @@ public Collection values() { @SideEffectFree @Override - public Collection> entries() { + public @PolyMutable Collection> entries(@PolyMutable SynchronizedMultimap this) { synchronized (mutex) { if (entries == null) { entries = typePreservingCollection(delegate().entries(), mutex); @@ -778,7 +791,7 @@ public void forEach(BiConsumer action) { } @Override - public Map> asMap() { + public @PolyMutable Map> asMap(@PolyMutable SynchronizedMultimap this) { synchronized (mutex) { if (asMap == null) { asMap = new SynchronizedAsMap<>(delegate().asMap(), mutex); @@ -788,7 +801,7 @@ public Map> asMap() { } @Override - public Multiset keys() { + public @PolyMutable Multiset keys(@PolyMutable SynchronizedMultimap this) { synchronized (mutex) { if (keys == null) { keys = multiset(delegate().keys(), mutex); @@ -799,7 +812,7 @@ public Multiset keys() { @Pure @Override - public boolean equals(@CheckForNull Object o) { + public boolean equals(@Readonly SynchronizedMultimap this, @CheckForNull @Readonly Object o) { if (o == this) { return true; } @@ -810,7 +823,7 @@ public boolean equals(@CheckForNull Object o) { @Pure @Override - public int hashCode(@UnknownSignedness SynchronizedMultimap this) { + public int hashCode(@UnknownSignedness @Readonly SynchronizedMultimap this) { synchronized (mutex) { return delegate().hashCode(); } @@ -819,42 +832,43 @@ public int hashCode(@UnknownSignedness SynchronizedMultimap this) { private static final long serialVersionUID = 0; } - static ListMultimap listMultimap( - ListMultimap multimap, @CheckForNull Object mutex) { + static ListMultimap listMultimap( + ListMultimap multimap, @CheckForNull @Readonly Object mutex) { if (multimap instanceof SynchronizedListMultimap || multimap instanceof BaseImmutableMultimap) { return multimap; } return new SynchronizedListMultimap<>(multimap, mutex); } + @ReceiverDependentMutable private static class SynchronizedListMultimap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends SynchronizedMultimap implements ListMultimap { - SynchronizedListMultimap(ListMultimap delegate, @CheckForNull Object mutex) { + SynchronizedListMultimap(@ReceiverDependentMutable ListMultimap delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - ListMultimap delegate() { + @PolyMutable ListMultimap delegate(@PolyMutable SynchronizedListMultimap this) { return (ListMultimap) super.delegate(); } @Override - public List get(K key) { + public List get(@Readonly SynchronizedListMultimap this, K key) { synchronized (mutex) { return list(delegate().get(key), mutex); } } @Override - public List removeAll(@CheckForNull Object key) { + public List removeAll(@Mutable SynchronizedListMultimap this, @CheckForNull @Readonly Object key) { synchronized (mutex) { return delegate().removeAll(key); // copy not synchronized } } @Override - public List replaceValues(K key, Iterable values) { + public List replaceValues(@Mutable SynchronizedListMultimap this, K key, Iterable values) { synchronized (mutex) { return delegate().replaceValues(key, values); // copy not synchronized } @@ -863,44 +877,45 @@ public List replaceValues(K key, Iterable values) { private static final long serialVersionUID = 0; } - static SetMultimap setMultimap( - SetMultimap multimap, @CheckForNull Object mutex) { + static SetMultimap setMultimap( + SetMultimap multimap, @CheckForNull @Readonly Object mutex) { if (multimap instanceof SynchronizedSetMultimap || multimap instanceof BaseImmutableMultimap) { return multimap; } return new SynchronizedSetMultimap<>(multimap, mutex); } + @ReceiverDependentMutable private static class SynchronizedSetMultimap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends SynchronizedMultimap implements SetMultimap { @CheckForNull transient Set> entrySet; - SynchronizedSetMultimap(SetMultimap delegate, @CheckForNull Object mutex) { + SynchronizedSetMultimap(@ReceiverDependentMutable SetMultimap delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - SetMultimap delegate() { + @PolyMutable SetMultimap delegate(@PolyMutable SynchronizedSetMultimap this) { return (SetMultimap) super.delegate(); } @Override - public Set get(K key) { + public Set get(@Readonly SynchronizedSetMultimap this, K key) { synchronized (mutex) { return set(delegate().get(key), mutex); } } @Override - public Set removeAll(@CheckForNull Object key) { + public Set removeAll(@Mutable SynchronizedSetMultimap this, @CheckForNull @Readonly Object key) { synchronized (mutex) { return delegate().removeAll(key); // copy not synchronized } } @Override - public Set replaceValues(K key, Iterable values) { + public Set replaceValues(@Mutable SynchronizedSetMultimap this, K key, Iterable values) { synchronized (mutex) { return delegate().replaceValues(key, values); // copy not synchronized } @@ -908,7 +923,7 @@ public Set replaceValues(K key, Iterable values) { @SideEffectFree @Override - public Set> entries() { + public @PolyMutable Set> entries(@PolyMutable SynchronizedSetMultimap this) { synchronized (mutex) { if (entrySet == null) { entrySet = set(delegate().entries(), mutex); @@ -920,43 +935,44 @@ public Set> entries() { private static final long serialVersionUID = 0; } - static + static SortedSetMultimap sortedSetMultimap( - SortedSetMultimap multimap, @CheckForNull Object mutex) { + SortedSetMultimap multimap, @CheckForNull @Readonly Object mutex) { if (multimap instanceof SynchronizedSortedSetMultimap) { return multimap; } return new SynchronizedSortedSetMultimap<>(multimap, mutex); } + @ReceiverDependentMutable private static class SynchronizedSortedSetMultimap< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends SynchronizedSetMultimap implements SortedSetMultimap { - SynchronizedSortedSetMultimap(SortedSetMultimap delegate, @CheckForNull Object mutex) { + SynchronizedSortedSetMultimap(@ReceiverDependentMutable SortedSetMultimap delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - SortedSetMultimap delegate() { + @PolyMutable SortedSetMultimap delegate(@PolyMutable SynchronizedSortedSetMultimap this) { return (SortedSetMultimap) super.delegate(); } @Override - public SortedSet get(K key) { + public SortedSet get(@Readonly SynchronizedSortedSetMultimap this, K key) { synchronized (mutex) { return sortedSet(delegate().get(key), mutex); } } @Override - public SortedSet removeAll(@CheckForNull Object key) { + public SortedSet removeAll(@Mutable SynchronizedSortedSetMultimap this, @CheckForNull @Readonly Object key) { synchronized (mutex) { return delegate().removeAll(key); // copy not synchronized } } @Override - public SortedSet replaceValues(K key, Iterable values) { + public SortedSet replaceValues(@Mutable SynchronizedSortedSetMultimap this, K key, Iterable values) { synchronized (mutex) { return delegate().replaceValues(key, values); // copy not synchronized } @@ -964,7 +980,7 @@ public SortedSet replaceValues(K key, Iterable values) { @Override @CheckForNull - public Comparator valueComparator() { + public Comparator valueComparator(@Readonly SynchronizedSortedSetMultimap this) { synchronized (mutex) { return delegate().valueComparator(); } @@ -973,8 +989,8 @@ public Comparator valueComparator() { private static final long serialVersionUID = 0; } - private static Collection typePreservingCollection( - Collection collection, @CheckForNull Object mutex) { + private static Collection typePreservingCollection( + Collection collection, @CheckForNull @Readonly Object mutex) { if (collection instanceof SortedSet) { return sortedSet((SortedSet) collection, mutex); } @@ -987,8 +1003,8 @@ public Comparator valueComparator() { return collection(collection, mutex); } - private static Set typePreservingSet( - Set set, @CheckForNull Object mutex) { + private static Set typePreservingSet( + Set set, @CheckForNull @Readonly Object mutex) { if (set instanceof SortedSet) { return sortedSet((SortedSet) set, mutex); } else { @@ -996,16 +1012,17 @@ public Comparator valueComparator() { } } + @ReceiverDependentMutable private static class SynchronizedAsMapEntries< - K extends @Nullable Object, V extends @Nullable Object> + K extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends SynchronizedSet>> { SynchronizedAsMapEntries( - Set>> delegate, @CheckForNull Object mutex) { + @ReceiverDependentMutable Set>> delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - public Iterator>> iterator() { + public Iterator>> iterator(@Readonly SynchronizedAsMapEntries this) { // Must be manually synchronized. return new TransformedIterator>, Map.Entry>>( super.iterator()) { @@ -1044,7 +1061,7 @@ public Collection getValue() { @Override //@SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations - public T[] toArray(@PolyNull T[] array) { + public T[] toArray(@PolyNull T[] array) { synchronized (mutex) { return ObjectArrays.toArrayImpl(delegate(), array); } @@ -1052,7 +1069,7 @@ public Collection getValue() { @Pure @Override - public boolean contains(@CheckForNull @UnknownSignedness Object o) { + public boolean contains(@Readonly SynchronizedAsMapEntries this, @CheckForNull @UnknownSignedness @Readonly Object o) { synchronized (mutex) { return Maps.containsEntryImpl(delegate(), o); } @@ -1060,7 +1077,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object o) { @Pure @Override - public boolean containsAll(Collection c) { + public boolean containsAll(@Readonly SynchronizedAsMapEntries this, @Readonly Collection c) { synchronized (mutex) { return Collections2.containsAllImpl(delegate(), c); } @@ -1068,7 +1085,7 @@ public boolean containsAll(Collection c) { @Pure @Override - public boolean equals(@CheckForNull @UnknownSignedness Object o) { + public boolean equals(@Readonly SynchronizedAsMapEntries this, @CheckForNull @UnknownSignedness @Readonly Object o) { if (o == this) { return true; } @@ -1078,21 +1095,21 @@ public boolean equals(@CheckForNull @UnknownSignedness Object o) { } @Override - public boolean remove(@CheckForNull @UnknownSignedness Object o) { + public boolean remove(@Mutable SynchronizedAsMapEntries this, @CheckForNull @UnknownSignedness @Readonly Object o) { synchronized (mutex) { return Maps.removeEntryImpl(delegate(), o); } } @Override - public boolean removeAll(Collection c) { + public boolean removeAll(@Mutable SynchronizedAsMapEntries this, @Readonly Collection c) { synchronized (mutex) { return Iterators.removeAll(delegate().iterator(), c); } } @Override - public boolean retainAll(Collection c) { + public boolean retainAll(@Mutable SynchronizedAsMapEntries this, @Readonly Collection c) { synchronized (mutex) { return Iterators.retainAll(delegate().iterator(), c); } @@ -1102,29 +1119,30 @@ public boolean retainAll(Collection c) { } @VisibleForTesting - static Map map( - Map map, @CheckForNull Object mutex) { + static Map map( + Map map, @CheckForNull @Readonly Object mutex) { return new SynchronizedMap<>(map, mutex); } - private static class SynchronizedMap + @ReceiverDependentMutable + private static class SynchronizedMap extends SynchronizedObject implements Map { @CheckForNull transient Set keySet; @CheckForNull transient Collection values; @CheckForNull transient Set> entrySet; - SynchronizedMap(Map delegate, @CheckForNull Object mutex) { + SynchronizedMap(@ReceiverDependentMutable Map delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @SuppressWarnings("unchecked") @Override - Map delegate() { + @PolyMutable Map delegate(@PolyMutable SynchronizedMap this) { return (Map) super.delegate(); } @Override - public void clear() { + public void clear(@Mutable SynchronizedMap this) { synchronized (mutex) { delegate().clear(); } @@ -1132,7 +1150,7 @@ public void clear() { @Pure @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@Readonly SynchronizedMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { synchronized (mutex) { return delegate().containsKey(key); } @@ -1140,7 +1158,7 @@ public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { @Pure @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly SynchronizedMap this, @CheckForNull @UnknownSignedness @Readonly Object value) { synchronized (mutex) { return delegate().containsValue(value); } @@ -1148,7 +1166,7 @@ public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { @SideEffectFree @Override - public Set> entrySet() { + public @PolyMutable Set> entrySet(@PolyMutable SynchronizedMap this) { synchronized (mutex) { if (entrySet == null) { entrySet = set(delegate().entrySet(), mutex); @@ -1166,7 +1184,7 @@ public void forEach(BiConsumer action) { @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@Readonly SynchronizedMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { synchronized (mutex) { return delegate().get(key); } @@ -1175,14 +1193,14 @@ public V get(@CheckForNull @UnknownSignedness Object key) { @Pure @Override @CheckForNull - public V getOrDefault(@CheckForNull @UnknownSignedness Object key, @CheckForNull V defaultValue) { + public V getOrDefault(@Readonly SynchronizedMap this, @CheckForNull @UnknownSignedness @Readonly Object key, @CheckForNull V defaultValue) { synchronized (mutex) { return delegate().getOrDefault(key, defaultValue); } } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly SynchronizedMap this) { synchronized (mutex) { return delegate().isEmpty(); } @@ -1190,7 +1208,7 @@ public boolean isEmpty() { @SideEffectFree @Override - public Set<@KeyFor({"this"}) K> keySet() { + public @PolyMutable Set<@KeyFor({"this"}) K> keySet(@PolyMutable SynchronizedMap this) { synchronized (mutex) { if (keySet == null) { keySet = set(delegate().keySet(), mutex); @@ -1201,7 +1219,7 @@ public boolean isEmpty() { @Override @CheckForNull - public V put(K key, V value) { + public V put(@Mutable SynchronizedMap this, K key, V value) { synchronized (mutex) { return delegate().put(key, value); } @@ -1209,14 +1227,14 @@ public V put(K key, V value) { @Override @CheckForNull - public V putIfAbsent(K key, V value) { + public V putIfAbsent(@Mutable SynchronizedMap this, K key, V value) { synchronized (mutex) { return delegate().putIfAbsent(key, value); } } @Override - public boolean replace(K key, V oldValue, V newValue) { + public boolean replace(@Mutable SynchronizedMap this, K key, V oldValue, V newValue) { synchronized (mutex) { return delegate().replace(key, oldValue, newValue); } @@ -1224,21 +1242,21 @@ public boolean replace(K key, V oldValue, V newValue) { @Override @CheckForNull - public V replace(K key, V value) { + public V replace(@Mutable SynchronizedMap this, K key, V value) { synchronized (mutex) { return delegate().replace(key, value); } } @Override - public @PolyNull V computeIfAbsent(K key, Function mappingFunction) { + public @PolyNull V computeIfAbsent(@Mutable SynchronizedMap this, K key, Function mappingFunction) { synchronized (mutex) { return delegate().computeIfAbsent(key, mappingFunction); } } @Override - public @PolyNull V computeIfPresent( + public @PolyNull V computeIfPresent(@Mutable SynchronizedMap this, K key, BiFunction remappingFunction) { synchronized (mutex) { return delegate().computeIfPresent(key, remappingFunction); @@ -1246,7 +1264,7 @@ public V replace(K key, V value) { } @Override - public @PolyNull V compute( + public @PolyNull V compute(@Mutable SynchronizedMap this, K key, BiFunction remappingFunction) { synchronized (mutex) { return delegate().compute(key, remappingFunction); @@ -1254,7 +1272,7 @@ public V replace(K key, V value) { } @Override - public @PolyNull V merge( + public @PolyNull V merge(@Mutable SynchronizedMap this, K key, V value, BiFunction remappingFunction) { synchronized (mutex) { return delegate().merge(key, value, remappingFunction); @@ -1262,14 +1280,14 @@ public V replace(K key, V value) { } @Override - public void putAll(Map map) { + public void putAll(@Mutable SynchronizedMap this, @Readonly Map map) { synchronized (mutex) { delegate().putAll(map); } } @Override - public void replaceAll(BiFunction function) { + public void replaceAll(@Mutable SynchronizedMap this, BiFunction function) { synchronized (mutex) { delegate().replaceAll(function); } @@ -1277,7 +1295,7 @@ public void replaceAll(BiFunction function) { @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@Mutable SynchronizedMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { synchronized (mutex) { return delegate().remove(key); } @@ -1285,14 +1303,14 @@ public V remove(@CheckForNull @UnknownSignedness Object key) { @Pure @Override - public boolean remove(@CheckForNull @UnknownSignedness Object key, @CheckForNull @UnknownSignedness Object value) { + public boolean remove(@Mutable SynchronizedMap this, @CheckForNull @UnknownSignedness @Readonly Object key, @CheckForNull @UnknownSignedness @Readonly Object value) { synchronized (mutex) { return delegate().remove(key, value); } } @Override - public @NonNegative int size() { + public @NonNegative int size(@Readonly SynchronizedMap this) { synchronized (mutex) { return delegate().size(); } @@ -1300,7 +1318,7 @@ public boolean remove(@CheckForNull @UnknownSignedness Object key, @CheckForNull @SideEffectFree @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable SynchronizedMap this) { synchronized (mutex) { if (values == null) { values = collection(delegate().values(), mutex); @@ -1311,7 +1329,7 @@ public Collection values() { @Pure @Override - public boolean equals(@CheckForNull Object o) { + public boolean equals(@Readonly SynchronizedMap this, @CheckForNull @Readonly Object o) { if (o == this) { return true; } @@ -1322,7 +1340,7 @@ public boolean equals(@CheckForNull Object o) { @Pure @Override - public int hashCode(@UnknownSignedness SynchronizedMap this) { + public int hashCode(@UnknownSignedness @Readonly SynchronizedMap this) { synchronized (mutex) { return delegate().hashCode(); } @@ -1331,20 +1349,21 @@ public int hashCode(@UnknownSignedness SynchronizedMap this) { private static final long serialVersionUID = 0; } - static SortedMap sortedMap( - SortedMap sortedMap, @CheckForNull Object mutex) { + static SortedMap sortedMap( + SortedMap sortedMap, @CheckForNull @Readonly Object mutex) { return new SynchronizedSortedMap<>(sortedMap, mutex); } - static class SynchronizedSortedMap + @ReceiverDependentMutable + static class SynchronizedSortedMap extends SynchronizedMap implements SortedMap { - SynchronizedSortedMap(SortedMap delegate, @CheckForNull Object mutex) { + SynchronizedSortedMap(@ReceiverDependentMutable SortedMap delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - SortedMap delegate() { + @PolyMutable SortedMap delegate(@PolyMutable SynchronizedSortedMap this) { return (SortedMap) super.delegate(); } @@ -1357,35 +1376,35 @@ public Comparator comparator() { } @Override - public @KeyFor("this") K firstKey() { + public @KeyFor("this") K firstKey(@Readonly SynchronizedSortedMap this) { synchronized (mutex) { return delegate().firstKey(); } } @Override - public SortedMap headMap(K toKey) { + public SortedMap headMap(@Readonly SynchronizedSortedMap this, K toKey) { synchronized (mutex) { return sortedMap(delegate().headMap(toKey), mutex); } } @Override - public @KeyFor("this") K lastKey() { + public @KeyFor("this") K lastKey(@Readonly SynchronizedSortedMap this) { synchronized (mutex) { return delegate().lastKey(); } } @Override - public SortedMap subMap(K fromKey, K toKey) { + public @PolyMutable SortedMap subMap(@PolyMutable SynchronizedSortedMap this, K fromKey, K toKey) { synchronized (mutex) { return sortedMap(delegate().subMap(fromKey, toKey), mutex); } } @Override - public SortedMap tailMap(K fromKey) { + public @PolyMutable SortedMap tailMap(@PolyMutable SynchronizedSortedMap this, K fromKey) { synchronized (mutex) { return sortedMap(delegate().tailMap(fromKey), mutex); } @@ -1394,8 +1413,8 @@ public SortedMap tailMap(K fromKey) { private static final long serialVersionUID = 0; } - static BiMap biMap( - BiMap bimap, @CheckForNull Object mutex) { + static BiMap biMap( + BiMap bimap, @CheckForNull @Readonly Object mutex) { if (bimap instanceof SynchronizedBiMap || bimap instanceof ImmutableBiMap) { return bimap; } @@ -1403,25 +1422,26 @@ public SortedMap tailMap(K fromKey) { } @VisibleForTesting - static class SynchronizedBiMap + @ReceiverDependentMutable + static class SynchronizedBiMap extends SynchronizedMap implements BiMap, Serializable { @CheckForNull private transient Set valueSet; @RetainedWith @CheckForNull private transient BiMap inverse; private SynchronizedBiMap( - BiMap delegate, @CheckForNull Object mutex, @CheckForNull BiMap inverse) { + @ReceiverDependentMutable BiMap delegate, @CheckForNull @Readonly Object mutex, @CheckForNull @ReceiverDependentMutable BiMap inverse) { super(delegate, mutex); this.inverse = inverse; } @Override - BiMap delegate() { + @PolyMutable BiMap delegate(@PolyMutable SynchronizedBiMap this) { return (BiMap) super.delegate(); } @SideEffectFree @Override - public Set values() { + public @PolyMutable Set values(@PolyMutable SynchronizedBiMap this) { synchronized (mutex) { if (valueSet == null) { valueSet = set(delegate().values(), mutex); @@ -1432,14 +1452,14 @@ public Set values() { @Override @CheckForNull - public V forcePut(K key, V value) { + public V forcePut(@Mutable SynchronizedBiMap this, K key, V value) { synchronized (mutex) { return delegate().forcePut(key, value); } } @Override - public BiMap inverse() { + public @PolyMutable BiMap inverse(@PolyMutable SynchronizedBiMap this) { synchronized (mutex) { if (inverse == null) { inverse = new SynchronizedBiMap<>(delegate().inverse(), mutex, this); @@ -1451,18 +1471,19 @@ public BiMap inverse() { private static final long serialVersionUID = 0; } - private static class SynchronizedAsMap + @ReceiverDependentMutable + private static class SynchronizedAsMap extends SynchronizedMap> { @CheckForNull transient Set>> asMapEntrySet; @CheckForNull transient Collection> asMapValues; - SynchronizedAsMap(Map> delegate, @CheckForNull Object mutex) { + SynchronizedAsMap(@ReceiverDependentMutable Map> delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override @CheckForNull - public Collection get(@CheckForNull @UnknownSignedness Object key) { + public Collection get(@Readonly SynchronizedAsMap this, @CheckForNull @UnknownSignedness @Readonly Object key) { synchronized (mutex) { Collection collection = super.get(key); return (collection == null) ? null : typePreservingCollection(collection, mutex); @@ -1471,7 +1492,7 @@ public Collection get(@CheckForNull @UnknownSignedness Object key) { @SideEffectFree @Override - public Set>> entrySet() { + public @PolyMutable Set>> entrySet(@PolyMutable SynchronizedAsMap this) { synchronized (mutex) { if (asMapEntrySet == null) { asMapEntrySet = new SynchronizedAsMapEntries<>(delegate().entrySet(), mutex); @@ -1482,7 +1503,7 @@ public Collection get(@CheckForNull @UnknownSignedness Object key) { @SideEffectFree @Override - public Collection> values() { + public @PolyMutable Collection> values(@PolyMutable SynchronizedAsMap this) { synchronized (mutex) { if (asMapValues == null) { asMapValues = new SynchronizedAsMapValues(delegate().values(), mutex); @@ -1493,7 +1514,7 @@ public Collection> values() { @Pure @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object o) { + public boolean containsValue(@Readonly SynchronizedAsMap this, @CheckForNull @UnknownSignedness @Readonly Object o) { // values() and its contains() method are both synchronized. return values().contains(o); } @@ -1501,14 +1522,15 @@ public boolean containsValue(@CheckForNull @UnknownSignedness Object o) { private static final long serialVersionUID = 0; } - private static class SynchronizedAsMapValues + @ReceiverDependentMutable + private static class SynchronizedAsMapValues extends SynchronizedCollection> { - SynchronizedAsMapValues(Collection> delegate, @CheckForNull Object mutex) { + SynchronizedAsMapValues(@ReceiverDependentMutable Collection> delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - public Iterator> iterator() { + public Iterator> iterator(@Readonly SynchronizedAsMapValues this) { // Must be manually synchronized. return new TransformedIterator, Collection>(super.iterator()) { @Override @@ -1531,55 +1553,56 @@ Collection transform(Collection from) { @Pure @Override - public boolean contains(@Nullable @UnknownSignedness Object arg0) { return super.contains(arg0); } + public boolean contains(@Readonly SynchronizedAsMapValues this, @Nullable @UnknownSignedness @Readonly Object arg0) { return super.contains(arg0); } @SuppressWarnings("nullness") @Pure @Override - public boolean containsAll(Collection arg0) { return super.containsAll(arg0); } + public boolean containsAll(@Readonly SynchronizedAsMapValues this, @Readonly Collection arg0) { return super.containsAll(arg0); } @Override - public boolean remove(@Nullable @UnknownSignedness Object arg0) { return super.remove(arg0); } + public boolean remove(@Mutable SynchronizedAsMapValues this, @Nullable @UnknownSignedness @Readonly Object arg0) { return super.remove(arg0); } @SuppressWarnings("nullness") @Override - public boolean removeAll(Collection arg0) { return super.removeAll(arg0); } + public boolean removeAll(@Mutable SynchronizedAsMapValues this, @Readonly Collection arg0) { return super.removeAll(arg0); } @SuppressWarnings("nullness") @Override - public boolean retainAll(Collection arg0) { return super.retainAll(arg0); } + public boolean retainAll(@Mutable SynchronizedAsMapValues this, @Readonly Collection arg0) { return super.retainAll(arg0); } } @GwtIncompatible // NavigableSet @VisibleForTesting - static class SynchronizedNavigableSet extends SynchronizedSortedSet + @ReceiverDependentMutable + static class SynchronizedNavigableSet extends SynchronizedSortedSet implements NavigableSet { - SynchronizedNavigableSet(NavigableSet delegate, @CheckForNull Object mutex) { + SynchronizedNavigableSet(@ReceiverDependentMutable NavigableSet delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @Override - NavigableSet delegate() { + @PolyMutable NavigableSet delegate(@PolyMutable SynchronizedNavigableSet this) { return (NavigableSet) super.delegate(); } @Override @CheckForNull - public E ceiling(E e) { + public E ceiling(@Readonly SynchronizedNavigableSet this, E e) { synchronized (mutex) { return delegate().ceiling(e); } } @Override - public Iterator descendingIterator() { + public Iterator descendingIterator(@Readonly SynchronizedNavigableSet this) { return delegate().descendingIterator(); // manually synchronized } @CheckForNull transient NavigableSet descendingSet; @Override - public NavigableSet descendingSet() { + public @PolyMutable NavigableSet descendingSet(@PolyMutable SynchronizedNavigableSet this) { synchronized (mutex) { if (descendingSet == null) { NavigableSet dS = Synchronized.navigableSet(delegate().descendingSet(), mutex); @@ -1672,34 +1695,35 @@ public SortedSet tailSet(E fromElement) { } @GwtIncompatible // NavigableSet - static NavigableSet navigableSet( - NavigableSet navigableSet, @CheckForNull Object mutex) { + static NavigableSet navigableSet( + NavigableSet navigableSet, @CheckForNull @Readonly Object mutex) { return new SynchronizedNavigableSet(navigableSet, mutex); } @GwtIncompatible // NavigableSet - static NavigableSet navigableSet(NavigableSet navigableSet) { + static NavigableSet navigableSet(NavigableSet navigableSet) { return navigableSet(navigableSet, null); } @GwtIncompatible // NavigableMap - static NavigableMap navigableMap( + static NavigableMap navigableMap( NavigableMap navigableMap) { return navigableMap(navigableMap, null); } @GwtIncompatible // NavigableMap - static NavigableMap navigableMap( - NavigableMap navigableMap, @CheckForNull Object mutex) { + static NavigableMap navigableMap( + NavigableMap navigableMap, @CheckForNull @Readonly Object mutex) { return new SynchronizedNavigableMap<>(navigableMap, mutex); } @GwtIncompatible // NavigableMap @VisibleForTesting - static class SynchronizedNavigableMap + @ReceiverDependentMutable + static class SynchronizedNavigableMap extends SynchronizedSortedMap implements NavigableMap { - SynchronizedNavigableMap(NavigableMap delegate, @CheckForNull Object mutex) { + SynchronizedNavigableMap(@ReceiverDependentMutable NavigableMap delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @@ -1887,9 +1911,9 @@ public SortedMap tailMap(K fromKey) { @GwtIncompatible // works but is needed only for NavigableMap @CheckForNull - private static + private static Map.Entry nullableSynchronizedEntry( - @CheckForNull Map.Entry entry, @CheckForNull Object mutex) { + @CheckForNull Map.Entry entry, @CheckForNull @Readonly Object mutex) { if (entry == null) { return null; } @@ -1897,10 +1921,11 @@ Map.Entry nullableSynchronizedEntry( } @GwtIncompatible // works but is needed only for NavigableMap - private static class SynchronizedEntry + @ReceiverDependentMutable + private static class SynchronizedEntry extends SynchronizedObject implements Map.Entry { - SynchronizedEntry(Map.Entry delegate, @CheckForNull Object mutex) { + SynchronizedEntry(Map.@ReceiverDependentMutable Entry delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @@ -1948,14 +1973,15 @@ public V setValue(V value) { private static final long serialVersionUID = 0; } - static Queue queue(Queue queue, @CheckForNull Object mutex) { + static Queue queue(Queue queue, @CheckForNull @Readonly Object mutex) { return (queue instanceof SynchronizedQueue) ? queue : new SynchronizedQueue(queue, mutex); } + @ReceiverDependentMutable private static class SynchronizedQueue extends SynchronizedCollection implements Queue { - SynchronizedQueue(Queue delegate, @CheckForNull Object mutex) { + SynchronizedQueue(@ReceiverDependentMutable Queue delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @@ -2004,14 +2030,15 @@ public E remove() { private static final long serialVersionUID = 0; } - static Deque deque(Deque deque, @CheckForNull Object mutex) { + static Deque deque(Deque deque, @CheckForNull @Readonly Object mutex) { return new SynchronizedDeque(deque, mutex); } + @ReceiverDependentMutable private static final class SynchronizedDeque extends SynchronizedQueue implements Deque { - SynchronizedDeque(Deque delegate, @CheckForNull Object mutex) { + SynchronizedDeque(@ReceiverDependentMutable Deque delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @@ -2146,48 +2173,49 @@ public Iterator descendingIterator() { private static final long serialVersionUID = 0; } - static - Table table(Table table, @CheckForNull Object mutex) { + static + Table table(Table table, @CheckForNull @Readonly Object mutex) { return new SynchronizedTable<>(table, mutex); } + @ReceiverDependentMutable private static final class SynchronizedTable< - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends SynchronizedObject implements Table { - SynchronizedTable(Table delegate, @CheckForNull Object mutex) { + SynchronizedTable(@ReceiverDependentMutable Table delegate, @CheckForNull @Readonly Object mutex) { super(delegate, mutex); } @SuppressWarnings("unchecked") @Override - Table delegate() { + @PolyMutable Table delegate(@PolyMutable SynchronizedTable this) { return (Table) super.delegate(); } @Override - public boolean contains(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public boolean contains(@Readonly SynchronizedTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { synchronized (mutex) { return delegate().contains(rowKey, columnKey); } } @Override - public boolean containsRow(@CheckForNull Object rowKey) { + public boolean containsRow(@Readonly SynchronizedTable this, @CheckForNull @Readonly Object rowKey) { synchronized (mutex) { return delegate().containsRow(rowKey); } } @Override - public boolean containsColumn(@CheckForNull Object columnKey) { + public boolean containsColumn(@Readonly SynchronizedTable this, @CheckForNull @Readonly Object columnKey) { synchronized (mutex) { return delegate().containsColumn(columnKey); } } @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly SynchronizedTable this, @CheckForNull @UnknownSignedness @Readonly Object value) { synchronized (mutex) { return delegate().containsValue(value); } @@ -2195,28 +2223,28 @@ public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { @Override @CheckForNull - public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V get(@Readonly SynchronizedTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { synchronized (mutex) { return delegate().get(rowKey, columnKey); } } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly SynchronizedTable this) { synchronized (mutex) { return delegate().isEmpty(); } } @Override - public int size() { + public int size(@Readonly SynchronizedTable this) { synchronized (mutex) { return delegate().size(); } } @Override - public void clear() { + public void clear(@Mutable SynchronizedTable this) { synchronized (mutex) { delegate().clear(); } @@ -2224,14 +2252,14 @@ public void clear() { @Override @CheckForNull - public V put(R rowKey, C columnKey, V value) { + public V put(@Mutable SynchronizedTable this, R rowKey, C columnKey, V value) { synchronized (mutex) { return delegate().put(rowKey, columnKey, value); } } @Override - public void putAll(Table table) { + public void putAll(@Mutable SynchronizedTable this, @Readonly Table table) { synchronized (mutex) { delegate().putAll(table); } @@ -2239,7 +2267,7 @@ public void putAll(Table table) { @Override @CheckForNull - public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V remove(@Mutable SynchronizedTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { synchronized (mutex) { return delegate().remove(rowKey, columnKey); } @@ -2260,35 +2288,35 @@ public Map column(C columnKey) { } @Override - public Set> cellSet() { + public @PolyMutable Set> cellSet(@PolyMutable SynchronizedTable this) { synchronized (mutex) { return set(delegate().cellSet(), mutex); } } @Override - public Set rowKeySet() { + public @PolyMutable Set rowKeySet(@PolyMutable SynchronizedTable this) { synchronized (mutex) { return set(delegate().rowKeySet(), mutex); } } @Override - public Set columnKeySet() { + public @PolyMutable Set columnKeySet(@PolyMutable SynchronizedTable this) { synchronized (mutex) { return set(delegate().columnKeySet(), mutex); } } @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable SynchronizedTable this) { synchronized (mutex) { return collection(delegate().values(), mutex); } } @Override - public Map> rowMap() { + public @PolyMutable Map> rowMap(@PolyMutable SynchronizedTable this) { synchronized (mutex) { return map( Maps.transformValues( @@ -2304,7 +2332,7 @@ public Map apply(Map t) { } @Override - public Map> columnMap() { + public @PolyMutable Map> columnMap(@PolyMutable SynchronizedTable this) { synchronized (mutex) { return map( Maps.transformValues( @@ -2320,14 +2348,14 @@ public Map apply(Map t) { } @Override - public int hashCode(@UnknownSignedness SynchronizedTable this) { + public int hashCode(@UnknownSignedness @Readonly SynchronizedTable this) { synchronized (mutex) { return delegate().hashCode(); } } @Override - public boolean equals(@CheckForNull Object obj) { + public boolean equals(@Readonly SynchronizedTable this, @CheckForNull @Readonly Object obj) { if (this == obj) { return true; } diff --git a/guava/src/com/google/common/collect/Table.java b/guava/src/com/google/common/collect/Table.java index 5fe7202b0e1d..447de33eb90f 100644 --- a/guava/src/com/google/common/collect/Table.java +++ b/guava/src/com/google/common/collect/Table.java @@ -26,7 +26,13 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A collection that associates an ordered pair of keys, called a row key and a column key, with a @@ -58,8 +64,10 @@ @DoNotMock("Use ImmutableTable, HashBasedTable, or another implementation") @GwtCompatible @ElementTypesAreNonnullByDefault +@AnnotatedFor("pico") +@ReceiverDependentMutable public interface Table< - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> { + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> { // TODO(jlevy): Consider adding methods similar to ConcurrentMap methods. // Accessors @@ -71,29 +79,30 @@ public interface Table< * @param columnKey key of column to search for */ boolean contains( - @CompatibleWith("R") @CheckForNull Object rowKey, - @CompatibleWith("C") @CheckForNull Object columnKey); + @Readonly Table this, + @CompatibleWith("R") @CheckForNull @Readonly Object rowKey, + @CompatibleWith("C") @CheckForNull @Readonly Object columnKey); /** * Returns {@code true} if the table contains a mapping with the specified row key. * * @param rowKey key of row to search for */ - boolean containsRow(@CompatibleWith("R") @CheckForNull Object rowKey); + boolean containsRow(@Readonly Table this, @CompatibleWith("R") @CheckForNull @Readonly Object rowKey); /** * Returns {@code true} if the table contains a mapping with the specified column. * * @param columnKey key of column to search for */ - boolean containsColumn(@CompatibleWith("C") @CheckForNull Object columnKey); + boolean containsColumn(@Readonly Table this, @CompatibleWith("C") @CheckForNull @Readonly Object columnKey); /** * Returns {@code true} if the table contains a mapping with the specified value. * * @param value value to search for */ - boolean containsValue(@CompatibleWith("V") @CheckForNull @UnknownSignedness Object value); + boolean containsValue(@Readonly Table this, @CompatibleWith("V") @CheckForNull @UnknownSignedness @Readonly Object value); /** * Returns the value corresponding to the given row and column keys, or {@code null} if no such @@ -104,33 +113,34 @@ boolean contains( */ @CheckForNull V get( - @CompatibleWith("R") @CheckForNull Object rowKey, - @CompatibleWith("C") @CheckForNull Object columnKey); + @Readonly Table this, + @CompatibleWith("R") @CheckForNull @Readonly Object rowKey, + @CompatibleWith("C") @CheckForNull @Readonly Object columnKey); /** Returns {@code true} if the table contains no mappings. */ - boolean isEmpty(); + boolean isEmpty(@Readonly Table this); /** Returns the number of row key / column key / value mappings in the table. */ - int size(); + int size(@Readonly Table this); /** * Compares the specified object with this table for equality. Two tables are equal when their * cell views, as returned by {@link #cellSet}, are equal. */ @Override - boolean equals(@CheckForNull Object obj); + boolean equals(@Readonly Table this, @CheckForNull @Readonly Object obj); /** * Returns the hash code for this table. The hash code of a table is defined as the hash code of * its cell view, as returned by {@link #cellSet}. */ @Override - int hashCode(@UnknownSignedness Table this); + int hashCode(@UnknownSignedness @Readonly Table this); // Mutators /** Removes all mappings from the table. */ - void clear(); + void clear(@Mutable Table this); /** * Associates the specified value with the specified keys. If the table already contained a @@ -144,7 +154,7 @@ V get( */ @CanIgnoreReturnValue @CheckForNull - V put(@ParametricNullness R rowKey, @ParametricNullness C columnKey, @ParametricNullness V value); + V put(@Mutable Table this, @ParametricNullness R rowKey, @ParametricNullness C columnKey, @ParametricNullness V value); /** * Copies all mappings from the specified table to this table. The effect is equivalent to calling @@ -152,7 +162,7 @@ V get( * * @param table the table to add to this table */ - void putAll(Table table); + void putAll(@Mutable Table this, @Readonly Table table); /** * Removes the mapping, if any, associated with the given keys. @@ -163,9 +173,9 @@ V get( */ @CanIgnoreReturnValue @CheckForNull - V remove( - @CompatibleWith("R") @CheckForNull Object rowKey, - @CompatibleWith("C") @CheckForNull Object columnKey); + V remove(@Mutable Table this, + @CompatibleWith("R") @CheckForNull @Readonly Object rowKey, + @CompatibleWith("C") @CheckForNull @Readonly Object columnKey); // Views @@ -179,7 +189,7 @@ V remove( * @param rowKey key of row to search for in the table * @return the corresponding map from column keys to values */ - Map row(@ParametricNullness R rowKey); + @PolyMutable Map row(@PolyMutable Table this, @ParametricNullness R rowKey); /** * Returns a view of all mappings that have the given column key. For each row key / column key / @@ -191,7 +201,7 @@ V remove( * @param columnKey key of column to search for in the table * @return the corresponding map from row keys to values */ - Map column(@ParametricNullness C columnKey); + @PolyMutable Map column(@PolyMutable Table this, @ParametricNullness C columnKey); /** * Returns a set of all row key / column key / value triplets. Changes to the returned set will @@ -200,7 +210,7 @@ V remove( * * @return set of table cells consisting of row key / column key / value triplets */ - Set> cellSet(); + @PolyMutable Set> cellSet(@PolyMutable Table this); /** * Returns a set of row keys that have one or more values in the table. Changes to the set will @@ -208,7 +218,7 @@ V remove( * * @return set of row keys */ - Set rowKeySet(); + @PolyMutable Set rowKeySet(@PolyMutable Table this); /** * Returns a set of column keys that have one or more values in the table. Changes to the set will @@ -216,7 +226,7 @@ V remove( * * @return set of column keys */ - Set columnKeySet(); + @PolyMutable Set columnKeySet(@PolyMutable Table this); /** * Returns a collection of all values, which may contain duplicates. Changes to the returned @@ -224,7 +234,7 @@ V remove( * * @return collection of values */ - Collection values(); + @PolyMutable Collection values(@PolyMutable Table this); /** * Returns a view that associates each row key with the corresponding map from column keys to @@ -237,7 +247,7 @@ V remove( * * @return a map view from each row key to a secondary map from column keys to values */ - Map> rowMap(); + @PolyMutable Map> rowMap(@PolyMutable Table this); /** * Returns a view that associates each column key with the corresponding map from row keys to @@ -250,33 +260,34 @@ V remove( * * @return a map view from each column key to a secondary map from row keys to values */ - Map> columnMap(); + @PolyMutable Map> columnMap(@PolyMutable Table this); /** * Row key / column key / value triplet corresponding to a mapping in a table. * * @since 7.0 */ + @ReceiverDependentMutable interface Cell< - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> { + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> { /** Returns the row key of this cell. */ @ParametricNullness - R getRowKey(); + R getRowKey(@Readonly Cell this); /** Returns the column key of this cell. */ @ParametricNullness - C getColumnKey(); + C getColumnKey(@Readonly Cell this); /** Returns the value of this cell. */ @ParametricNullness - V getValue(); + V getValue(@Readonly Cell this); /** * Compares the specified object with this cell for equality. Two cells are equal when they have * equal row keys, column keys, and values. */ @Override - boolean equals(@CheckForNull Object obj); + boolean equals(@Readonly Cell this, @CheckForNull @Readonly Object obj); /** * Returns the hash code of this cell. @@ -285,6 +296,6 @@ interface Cell< * e.getColumnKey(), e.getValue())}. */ @Override - int hashCode(@UnknownSignedness Cell this); + int hashCode(@UnknownSignedness @Readonly Cell this); } } diff --git a/guava/src/com/google/common/collect/TableCollectors.java b/guava/src/com/google/common/collect/TableCollectors.java index 16fcb166969a..46213f37cd04 100644 --- a/guava/src/com/google/common/collect/TableCollectors.java +++ b/guava/src/com/google/common/collect/TableCollectors.java @@ -27,13 +27,16 @@ import java.util.function.Supplier; import java.util.stream.Collector; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; /** Collectors utilities for {@code common.collect.Table} internals. */ @GwtCompatible @ElementTypesAreNonnullByDefault final class TableCollectors { - static + static Collector> toImmutableTable( Function rowFunction, Function columnFunction, @@ -49,7 +52,7 @@ final class TableCollectors { ImmutableTable.Builder::build); } - static + static Collector> toImmutableTable( Function rowFunction, Function columnFunction, @@ -80,10 +83,10 @@ final class TableCollectors { } static < - T extends @Nullable Object, - R extends @Nullable Object, - C extends @Nullable Object, - V extends @Nullable Object, + T extends @Nullable @Readonly Object, + R extends @Nullable @Immutable Object, + C extends @Nullable @Immutable Object, + V extends @Nullable @Readonly Object, I extends Table> Collector toTable( java.util.function.Function rowFunction, @@ -101,10 +104,10 @@ final class TableCollectors { } static < - T extends @Nullable Object, - R extends @Nullable Object, - C extends @Nullable Object, - V extends @Nullable Object, + T extends @Nullable @Readonly Object, + R extends @Nullable @Immutable Object, + C extends @Nullable @Immutable Object, + V extends @Nullable @Readonly Object, I extends Table> Collector toTable( java.util.function.Function rowFunction, @@ -135,9 +138,10 @@ final class TableCollectors { }); } - private static final class ImmutableTableCollectorState { - final List> insertionOrder = new ArrayList<>(); - final Table> table = HashBasedTable.create(); + @Immutable + private static final class ImmutableTableCollectorState { + final @Mutable List> insertionOrder = new ArrayList<>(); + final @Mutable Table> table = HashBasedTable.create(); void put(R row, C column, V value, BinaryOperator merger) { MutableCell oldCell = table.get(row, column); @@ -163,12 +167,12 @@ ImmutableTable toTable() { } } - private static final class MutableCell extends AbstractCell { + private static final class MutableCell extends AbstractCell { private final R row; private final C column; private V value; - MutableCell(R row, C column, V value) { + MutableCell(R row, C column, V value) { this.row = checkNotNull(row, "row"); this.column = checkNotNull(column, "column"); this.value = checkNotNull(value, "value"); @@ -196,9 +200,9 @@ void merge(V value, BinaryOperator mergeFunction) { } private static < - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> void mergeTables( - Table table, + Table table, @ParametricNullness R row, @ParametricNullness C column, @ParametricNullness V value, diff --git a/guava/src/com/google/common/collect/Tables.java b/guava/src/com/google/common/collect/Tables.java index 0c994ea521fc..818c10052785 100644 --- a/guava/src/com/google/common/collect/Tables.java +++ b/guava/src/com/google/common/collect/Tables.java @@ -39,7 +39,13 @@ import java.util.stream.Collector; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Provides static methods that involve a {@code Table}. @@ -51,6 +57,7 @@ * @author Louis Wasserman * @since 7.0 */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault public final class Tables { @@ -70,10 +77,10 @@ private Tables() {} */ @Beta public static < - T extends @Nullable Object, - R extends @Nullable Object, - C extends @Nullable Object, - V extends @Nullable Object, + T extends @Nullable @Readonly Object, + R extends @Nullable @Immutable Object, + C extends @Nullable @Immutable Object, + V extends @Nullable @Readonly Object, I extends Table> Collector toTable( java.util.function.Function rowFunction, @@ -98,10 +105,10 @@ private Tables() {} * @since 21.0 */ public static < - T extends @Nullable Object, - R extends @Nullable Object, - C extends @Nullable Object, - V extends @Nullable Object, + T extends @Nullable @Readonly Object, + R extends @Nullable @Immutable Object, + C extends @Nullable @Immutable Object, + V extends @Nullable @Readonly Object, I extends Table> Collector toTable( java.util.function.Function rowFunction, @@ -122,16 +129,17 @@ private Tables() {} * @param columnKey the column key to be associated with the returned cell * @param value the value to be associated with the returned cell */ - public static - Cell immutableCell( + public static + @Immutable Cell immutableCell( @ParametricNullness R rowKey, @ParametricNullness C columnKey, @ParametricNullness V value) { return new ImmutableCell<>(rowKey, columnKey, value); } + @Immutable static final class ImmutableCell< - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends AbstractCell implements Serializable { @ParametricNullness private final R rowKey; @ParametricNullness private final C columnKey; @@ -167,14 +175,15 @@ public V getValue() { private static final long serialVersionUID = 0; } + @ReceiverDependentMutable abstract static class AbstractCell< - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> implements Cell { // needed for serialization AbstractCell() {} @Override - public boolean equals(@CheckForNull Object obj) { + public boolean equals(@Readonly AbstractCell this, @CheckForNull @Readonly Object obj) { if (obj == this) { return true; } @@ -188,12 +197,12 @@ public boolean equals(@CheckForNull Object obj) { } @Override - public int hashCode(@UnknownSignedness AbstractCell this) { + public int hashCode(@UnknownSignedness @Readonly AbstractCell this) { return Objects.hashCode(getRowKey(), getColumnKey(), getValue()); } @Override - public String toString() { + public String toString(@Readonly AbstractCell this) { return "(" + getRowKey() + "," + getColumnKey() + ")=" + getValue(); } } @@ -210,71 +219,73 @@ public String toString() { * columnKeySet().iterator()} doesn't. With a transposed {@link HashBasedTable}, it's the other * way around. */ - public static + public static Table transpose(Table table) { return (table instanceof TransposeTable) ? ((TransposeTable) table).original : new TransposeTable(table); } + @ReceiverDependentMutable private static class TransposeTable< - C extends @Nullable Object, R extends @Nullable Object, V extends @Nullable Object> + C extends @Nullable @Immutable Object, R extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends AbstractTable { final Table original; - TransposeTable(Table original) { + TransposeTable(@ReceiverDependentMutable Table original) { this.original = checkNotNull(original); } @Override - public void clear() { + public void clear(@Mutable TransposeTable this) { original.clear(); } @Override - public Map column(@ParametricNullness R columnKey) { + public @PolyMutable Map column(@PolyMutable TransposeTable this, @ParametricNullness R columnKey) { return original.row(columnKey); } @Override - public Set columnKeySet() { + public @PolyMutable Set columnKeySet(@PolyMutable TransposeTable this) { return original.rowKeySet(); } @Override - public Map> columnMap() { + public @PolyMutable Map> columnMap(@PolyMutable TransposeTable this) { return original.rowMap(); } @Override - public boolean contains(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public boolean contains(@Readonly TransposeTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { return original.contains(columnKey, rowKey); } @Override - public boolean containsColumn(@CheckForNull Object columnKey) { + public boolean containsColumn(@Readonly TransposeTable this, @CheckForNull @Readonly Object columnKey) { return original.containsRow(columnKey); } @Override - public boolean containsRow(@CheckForNull Object rowKey) { + public boolean containsRow(@Readonly TransposeTable this, @CheckForNull @Readonly Object rowKey) { return original.containsColumn(rowKey); } @Override - public boolean containsValue(@CheckForNull @UnknownSignedness Object value) { + public boolean containsValue(@Readonly TransposeTable this, @CheckForNull @UnknownSignedness @Readonly Object value) { return original.containsValue(value); } @Override @CheckForNull - public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V get(@Readonly TransposeTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { return original.get(columnKey, rowKey); } @Override @CheckForNull public V put( + @Mutable TransposeTable this, @ParametricNullness C rowKey, @ParametricNullness R columnKey, @ParametricNullness V value) { @@ -282,38 +293,38 @@ public V put( } @Override - public void putAll(Table table) { + public void putAll(@Mutable TransposeTable this, @Readonly Table table) { original.putAll(transpose(table)); } @Override @CheckForNull - public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V remove(@Mutable TransposeTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { return original.remove(columnKey, rowKey); } @Override - public Map row(@ParametricNullness C rowKey) { + public @PolyMutable Map row(@PolyMutable TransposeTable this, @ParametricNullness C rowKey) { return original.column(rowKey); } @Override - public Set rowKeySet() { + public @PolyMutable Set rowKeySet(@PolyMutable TransposeTable this) { return original.columnKeySet(); } @Override - public Map> rowMap() { + public @PolyMutable Map> rowMap(@PolyMutable TransposeTable this) { return original.columnMap(); } @Override - public int size() { + public int size(@Readonly TransposeTable this) { return original.size(); } @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable TransposeTable this) { return original.values(); } @@ -328,13 +339,13 @@ public Collection values() { @SuppressWarnings("unchecked") @Override - Iterator> cellIterator() { + Iterator> cellIterator(@Readonly TransposeTable this) { return Iterators.transform(original.cellSet().iterator(), (Function) TRANSPOSE_CELL); } @SuppressWarnings("unchecked") @Override - Spliterator> cellSpliterator() { + Spliterator> cellSpliterator(@Readonly TransposeTable this) { return CollectSpliterators.map(original.cellSet().spliterator(), (Function) TRANSPOSE_CELL); } } @@ -378,7 +389,7 @@ Spliterator> cellSpliterator() { * @since 10.0 */ @Beta - public static Table newCustomTable( + public static Table newCustomTable( Map> backingMap, Supplier> factory) { checkArgument(backingMap.isEmpty()); checkNotNull(factory); @@ -409,37 +420,38 @@ public static Table newCustomTable( */ @Beta public static < - R extends @Nullable Object, - C extends @Nullable Object, - V1 extends @Nullable Object, - V2 extends @Nullable Object> + R extends @Nullable @Immutable Object, + C extends @Nullable @Immutable Object, + V1 extends @Nullable @Readonly Object, + V2 extends @Nullable @Readonly Object> Table transformValues( Table fromTable, Function function) { return new TransformedTable<>(fromTable, function); } + @ReceiverDependentMutable private static class TransformedTable< - R extends @Nullable Object, - C extends @Nullable Object, - V1 extends @Nullable Object, - V2 extends @Nullable Object> + R extends @Nullable @Immutable Object, + C extends @Nullable @Immutable Object, + V1 extends @Nullable @Readonly Object, + V2 extends @Nullable @Readonly Object> extends AbstractTable { final Table fromTable; final Function function; - TransformedTable(Table fromTable, Function function) { + TransformedTable(@ReceiverDependentMutable Table fromTable, Function function) { this.fromTable = checkNotNull(fromTable); this.function = checkNotNull(function); } @Override - public boolean contains(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public boolean contains(@Readonly TransformedTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { return fromTable.contains(rowKey, columnKey); } @Override @CheckForNull - public V2 get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V2 get(@Readonly TransformedTable this, @CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { // The function is passed a null input only when the table contains a null // value. // The cast is safe because of the contains() check. @@ -449,12 +461,12 @@ public V2 get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { } @Override - public int size() { + public int size(@Readonly TransformedTable this) { return fromTable.size(); } @Override - public void clear() { + public void clear(@Mutable TransformedTable this) { fromTable.clear(); } @@ -468,13 +480,13 @@ public V2 put( } @Override - public void putAll(Table table) { + public void putAll(@Readonly Table table) { throw new UnsupportedOperationException(); } @Override @CheckForNull - public V2 remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { + public V2 remove(@CheckForNull @Readonly Object rowKey, @CheckForNull @Readonly Object columnKey) { return contains(rowKey, columnKey) // The cast is safe because of the contains() check. ? function.apply(uncheckedCastNullableTToT(fromTable.remove(rowKey, columnKey))) @@ -482,12 +494,12 @@ public V2 remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) { } @Override - public Map row(@ParametricNullness R rowKey) { + public @PolyMutable Map row(@PolyMutable TransformedTable this, @ParametricNullness R rowKey) { return Maps.transformValues(fromTable.row(rowKey), function); } @Override - public Map column(@ParametricNullness C columnKey) { + public @PolyMutable Map column(@PolyMutable TransformedTable this, @ParametricNullness C columnKey) { return Maps.transformValues(fromTable.column(columnKey), function); } @@ -502,32 +514,32 @@ public Cell apply(Cell cell) { } @Override - Iterator> cellIterator() { + Iterator> cellIterator(@Readonly TransformedTable this) { return Iterators.transform(fromTable.cellSet().iterator(), cellFunction()); } @Override - Spliterator> cellSpliterator() { + Spliterator> cellSpliterator(@Readonly TransformedTable this) { return CollectSpliterators.map(fromTable.cellSet().spliterator(), cellFunction()); } @Override - public Set rowKeySet() { + public @PolyMutable Set rowKeySet(@PolyMutable TransformedTable this) { return fromTable.rowKeySet(); } @Override - public Set columnKeySet() { + public @PolyMutable Set columnKeySet(@PolyMutable TransformedTable this) { return fromTable.columnKeySet(); } @Override - Collection createValues() { + @PolyMutable Collection createValues(@PolyMutable TransformedTable this) { return Collections2.transform(fromTable.values(), function); } @Override - public Map> rowMap() { + public @PolyMutable Map> rowMap(@PolyMutable TransformedTable this) { Function, Map> rowFunction = new Function, Map>() { @Override @@ -539,7 +551,7 @@ public Map apply(Map row) { } @Override - public Map> columnMap() { + public @PolyMutable Map> columnMap(@PolyMutable TransformedTable this) { Function, Map> columnFunction = new Function, Map>() { @Override @@ -563,28 +575,29 @@ public Map apply(Map column) { * * @since 11.0 */ - public static - Table unmodifiableTable(Table table) { + public static + @Readonly Table unmodifiableTable(Table table) { return new UnmodifiableTable<>(table); } + @Immutable private static class UnmodifiableTable< - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends ForwardingTable implements Serializable { - final Table delegate; + final @Readonly Table delegate; - UnmodifiableTable(Table delegate) { + UnmodifiableTable(@Readonly Table delegate) { this.delegate = checkNotNull(delegate); } @SuppressWarnings("unchecked") // safe, covariant cast @Override - protected Table delegate() { + protected @Readonly Table delegate() { return (Table) delegate; } @Override - public Set> cellSet() { + public @Readonly Set<@Readonly Cell> cellSet() { return Collections.unmodifiableSet(super.cellSet()); } @@ -594,17 +607,17 @@ public void clear() { } @Override - public Map column(@ParametricNullness C columnKey) { + public @Readonly Map column(@ParametricNullness C columnKey) { return Collections.unmodifiableMap(super.column(columnKey)); } @Override - public Set columnKeySet() { + public @Readonly Set columnKeySet() { return Collections.unmodifiableSet(super.columnKeySet()); } @Override - public Map> columnMap() { + public @Readonly Map> columnMap() { Function, Map> wrapper = unmodifiableWrapper(); return Collections.unmodifiableMap(Maps.transformValues(super.columnMap(), wrapper)); } @@ -666,8 +679,8 @@ public Collection values() { * @since 11.0 */ @Beta - public static - RowSortedTable unmodifiableRowSortedTable( + public static + @Readonly RowSortedTable unmodifiableRowSortedTable( RowSortedTable table) { /* * It's not ? extends R, because it's technically not covariant in R. Specifically, @@ -677,27 +690,28 @@ RowSortedTable unmodifiableRowSortedTable( return new UnmodifiableRowSortedMap<>(table); } + @Immutable static final class UnmodifiableRowSortedMap< - R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> + R extends @Nullable @Immutable Object, C extends @Nullable @Immutable Object, V extends @Nullable @Readonly Object> extends UnmodifiableTable implements RowSortedTable { - public UnmodifiableRowSortedMap(RowSortedTable delegate) { + public UnmodifiableRowSortedMap(@Readonly RowSortedTable delegate) { super(delegate); } @Override - protected RowSortedTable delegate() { + protected @Readonly RowSortedTable delegate() { return (RowSortedTable) super.delegate(); } @Override - public SortedMap> rowMap() { + public @Readonly SortedMap> rowMap() { Function, Map> wrapper = unmodifiableWrapper(); return Collections.unmodifiableSortedMap(Maps.transformValues(delegate().rowMap(), wrapper)); } @Override - public SortedSet rowKeySet() { + public @Readonly SortedSet rowKeySet() { return Collections.unmodifiableSortedSet(delegate().rowKeySet()); } @@ -705,15 +719,15 @@ public SortedSet rowKeySet() { } @SuppressWarnings("unchecked") - private static + private static Function, Map> unmodifiableWrapper() { return (Function) UNMODIFIABLE_WRAPPER; } private static final Function, ? extends Map> UNMODIFIABLE_WRAPPER = - new Function, Map>() { + new Function, Map<@Immutable Object, @Readonly Object>>() { @Override - public Map apply(Map input) { + public @Readonly Map<@Immutable Object, @Readonly Object> apply(Map<@Immutable Object, @Readonly Object> input) { return Collections.unmodifiableMap(input); } }; @@ -747,12 +761,12 @@ public Map apply(Map input) { * @return a synchronized view of the specified table * @since 22.0 */ - public static + public static Table synchronizedTable(Table table) { return Synchronized.table(table, null); } - static boolean equalsImpl(Table table, @CheckForNull @UnknownSignedness Object obj) { + static boolean equalsImpl(@Readonly Table table, @CheckForNull @UnknownSignedness @Readonly Object obj) { if (obj == table) { return true; } else if (obj instanceof Table) { diff --git a/guava/src/com/google/common/collect/TopKSelector.java b/guava/src/com/google/common/collect/TopKSelector.java index 20b17fdef10e..eed844317074 100644 --- a/guava/src/com/google/common/collect/TopKSelector.java +++ b/guava/src/com/google/common/collect/TopKSelector.java @@ -31,6 +31,7 @@ import java.util.stream.Stream; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; /** * An accumulator that selects the "top" {@code k} elements added to it, relative to a provided @@ -56,7 +57,7 @@ @GwtCompatible @ElementTypesAreNonnullByDefault final class TopKSelector< - T extends @Nullable Object> { + T extends @Nullable @Readonly Object> { /** * Returns a {@code TopKSelector} that collects the lowest {@code k} elements added to it, @@ -75,7 +76,7 @@ public static > TopKSelector least(int k) { * * @throws IllegalArgumentException if {@code k < 0} or {@code k > Integer.MAX_VALUE / 2} */ - public static TopKSelector least( + public static TopKSelector least( int k, Comparator comparator) { return new TopKSelector(comparator, k); } diff --git a/guava/src/com/google/common/collect/TransformedIterator.java b/guava/src/com/google/common/collect/TransformedIterator.java index 2456cecde991..8437b0039fd1 100644 --- a/guava/src/com/google/common/collect/TransformedIterator.java +++ b/guava/src/com/google/common/collect/TransformedIterator.java @@ -21,6 +21,9 @@ import com.google.common.annotations.GwtCompatible; import java.util.Iterator; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * An iterator that transforms a backing iterator; for internal use. This avoids the object overhead @@ -30,11 +33,12 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class TransformedIterator +@ReceiverDependentMutable +abstract class TransformedIterator implements Iterator { final Iterator backingIterator; - TransformedIterator(Iterator backingIterator) { + TransformedIterator(@ReceiverDependentMutable Iterator backingIterator) { this.backingIterator = checkNotNull(backingIterator); } @@ -42,18 +46,18 @@ abstract class TransformedIterator this) { return backingIterator.hasNext(); } @Override @ParametricNullness - public final T next() { + public final T next(@Mutable TransformedIterator this) { return transform(backingIterator.next()); } @Override - public final void remove() { + public final void remove(@Mutable TransformedIterator this) { backingIterator.remove(); } } diff --git a/guava/src/com/google/common/collect/TransformedListIterator.java b/guava/src/com/google/common/collect/TransformedListIterator.java index 094f2ab1221a..1a8461ae8829 100644 --- a/guava/src/com/google/common/collect/TransformedListIterator.java +++ b/guava/src/com/google/common/collect/TransformedListIterator.java @@ -21,6 +21,8 @@ import java.util.ListIterator; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * An iterator that transforms a backing list iterator; for internal use. This avoids the object @@ -30,9 +32,10 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault -abstract class TransformedListIterator +@ReceiverDependentMutable +abstract class TransformedListIterator extends TransformedIterator implements ListIterator { - TransformedListIterator(ListIterator backingIterator) { + TransformedListIterator(@ReceiverDependentMutable ListIterator backingIterator) { super(backingIterator); } diff --git a/guava/src/com/google/common/collect/TreeBasedTable.java b/guava/src/com/google/common/collect/TreeBasedTable.java index a99deaf0c229..712b9a2d261e 100644 --- a/guava/src/com/google/common/collect/TreeBasedTable.java +++ b/guava/src/com/google/common/collect/TreeBasedTable.java @@ -34,6 +34,9 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; /** * Implementation of {@code Table} whose row keys and column keys are ordered by their natural @@ -69,10 +72,11 @@ */ @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault -public class TreeBasedTable extends StandardRowSortedTable { +@ReceiverDependentMutable +public class TreeBasedTable extends StandardRowSortedTable { private final Comparator columnComparator; - private static class Factory implements Supplier>, Serializable { + private static class Factory implements Supplier>, Serializable { final Comparator comparator; Factory(Comparator comparator) { @@ -105,7 +109,7 @@ public static TreeBasedTable TreeBasedTable create( + public static TreeBasedTable create( Comparator rowComparator, Comparator columnComparator) { checkNotNull(rowComparator); checkNotNull(columnComparator); @@ -116,7 +120,7 @@ public static TreeBasedTable create( * Creates a {@code TreeBasedTable} with the same mappings and sort order as the specified {@code * TreeBasedTable}. */ - public static TreeBasedTable create(TreeBasedTable table) { + public static TreeBasedTable create(TreeBasedTable table) { TreeBasedTable result = new TreeBasedTable<>(table.rowComparator(), table.columnComparator()); result.putAll(table); @@ -175,6 +179,7 @@ public SortedMap row(R rowKey) { return new TreeRow(rowKey); } + @ReceiverDependentMutable private class TreeRow extends Row implements SortedMap { @CheckForNull final C lowerBound; @CheckForNull final C upperBound; @@ -208,7 +213,7 @@ int compare(Object a, Object b) { return cmp.compare(a, b); } - boolean rangeContains(@CheckForNull Object o) { + boolean rangeContains(@CheckForNull @Readonly Object o) { return o != null && (lowerBound == null || compare(lowerBound, o) <= 0) && (upperBound == null || compare(upperBound, o) > 0); @@ -287,7 +292,7 @@ void maintainEmptyInvariant() { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return rangeContains(key) && super.containsKey(key); } diff --git a/guava/src/com/google/common/collect/TreeMultimap.java b/guava/src/com/google/common/collect/TreeMultimap.java index 1451bfdac995..2670fdb6c419 100644 --- a/guava/src/com/google/common/collect/TreeMultimap.java +++ b/guava/src/com/google/common/collect/TreeMultimap.java @@ -33,6 +33,11 @@ import java.util.TreeSet; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; @@ -74,18 +79,19 @@ * @author Louis Wasserman * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible(serializable = true, emulated = true) @ElementTypesAreNonnullByDefault -public class TreeMultimap +@ReceiverDependentMutable +public class TreeMultimap extends AbstractSortedKeySortedSetMultimap { - private transient Comparator keyComparator; - private transient Comparator valueComparator; + private transient @Mutable Comparator keyComparator; + private transient @Mutable Comparator valueComparator; /** * Creates an empty {@code TreeMultimap} ordered by the natural ordering of its keys and values. */ - public static TreeMultimap create() { + public static TreeMultimap create() { return new TreeMultimap<>(Ordering.natural(), Ordering.natural()); } @@ -96,7 +102,7 @@ public static TreeMultimap cr * @param keyComparator the comparator that determines the key ordering * @param valueComparator the comparator that determines the value ordering */ - public static TreeMultimap create( + public static TreeMultimap create( Comparator keyComparator, Comparator valueComparator) { return new TreeMultimap<>(checkNotNull(keyComparator), checkNotNull(valueComparator)); } @@ -107,13 +113,13 @@ public static TreeMultimap cr * * @param multimap the multimap whose contents are copied to this multimap */ - public static TreeMultimap create( - Multimap multimap) { - return new TreeMultimap<>(Ordering.natural(), Ordering.natural(), multimap); + public static @PolyMutable TreeMultimap create( + @PolyMutable Multimap multimap) { + return new @PolyMutable TreeMultimap<>(Ordering.natural(), Ordering.natural(), multimap); } TreeMultimap(@Nullable Comparator keyComparator, @Nullable Comparator valueComparator) { - super(new TreeMap>(keyComparator)); + super(new @ReceiverDependentMutable TreeMap>(keyComparator)); this.keyComparator = keyComparator; this.valueComparator = valueComparator; } @@ -127,7 +133,7 @@ private TreeMultimap( } @Override - Map> createAsMap() { + @PolyMutable Map> createAsMap(@PolyMutable TreeMultimap this) { return createMaybeNavigableAsMap(); } @@ -139,12 +145,12 @@ Map> createAsMap() { * @return a new {@code TreeSet} containing a collection of values for one key */ @Override - SortedSet createCollection() { - return new TreeSet<>(valueComparator); + @PolyMutable SortedSet createCollection(@PolyMutable TreeMultimap this) { + return new @PolyMutable TreeSet<>(valueComparator); } @Override - Collection createCollection(@ParametricNullness K key) { + @PolyMutable Collection createCollection(@PolyMutable TreeMultimap this, @ParametricNullness K key) { if (key == null) { keyComparator().compare(key, key); } @@ -157,20 +163,20 @@ Collection createCollection(@ParametricNullness K key) { * @deprecated Use {@code ((NavigableSet) multimap.keySet()).comparator()} instead. */ @Deprecated - public @Nullable Comparator keyComparator() { + public @Nullable Comparator keyComparator(@Readonly TreeMultimap this) { return keyComparator; } @Override - public @Nullable Comparator valueComparator() { + public @Nullable Comparator valueComparator(@Readonly TreeMultimap this) { return valueComparator; } /** @since 14.0 (present with return type {@code SortedSet} since 2.0) */ @Override @GwtIncompatible // NavigableSet - public NavigableSet get(@ParametricNullness K key) { - return (NavigableSet) super.get(key); + public @PolyMutable NavigableSet get(@PolyMutable TreeMultimap this, @ParametricNullness K key) { + return (@PolyMutable NavigableSet) super.get(key); } /** @@ -184,7 +190,7 @@ public NavigableSet get(@ParametricNullness K key) { */ @SideEffectFree @Override - public NavigableSet keySet() { + public @PolyMutable NavigableSet keySet(@PolyMutable TreeMultimap this) { return (NavigableSet) super.keySet(); } @@ -198,8 +204,8 @@ public NavigableSet keySet() { * @since 14.0 (present with return type {@code SortedMap} since 2.0) */ @Override - public NavigableMap> asMap() { - return (NavigableMap>) super.asMap(); + public @PolyMutable NavigableMap> asMap(@PolyMutable TreeMultimap this) { + return (@PolyMutable NavigableMap>) super.asMap(); } /** @@ -228,7 +234,7 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo private static final long serialVersionUID = 0; @Pure -public boolean equals(@Nullable Object arg0) { return super.equals(arg0); } +public boolean equals(@Readonly TreeMultimap this, @Nullable @Readonly Object arg0) { return super.equals(arg0); } -public SortedSet removeAll(@Nullable Object arg0) { return super.removeAll(arg0); } +public @Readonly SortedSet removeAll(@Mutable TreeMultimap this, @Nullable @Readonly Object arg0) { return super.removeAll(arg0); } } diff --git a/guava/src/com/google/common/collect/TreeMultiset.java b/guava/src/com/google/common/collect/TreeMultiset.java index 2b3bd07940b6..d813886d6890 100644 --- a/guava/src/com/google/common/collect/TreeMultiset.java +++ b/guava/src/com/google/common/collect/TreeMultiset.java @@ -41,6 +41,10 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.framework.qual.AnnotatedFor; @@ -65,7 +69,8 @@ @AnnotatedFor({"nullness"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -public final class TreeMultiset extends AbstractSortedMultiset +@ReceiverDependentMutable +public final class TreeMultiset extends AbstractSortedMultiset implements Serializable { /** @@ -80,7 +85,7 @@ public final class TreeMultiset extends AbstractSort *

The type specification is {@code }, instead of the more specific * {@code >}, to support classes defined without generics. */ - public static TreeMultiset create() { + public static TreeMultiset create() { return new TreeMultiset(Ordering.natural()); } @@ -96,7 +101,7 @@ public static TreeMultiset create() { * indicates that the elements' natural ordering should be used. */ @SuppressWarnings("unchecked") - public static TreeMultiset create( + public static TreeMultiset create( @CheckForNull Comparator comparator) { return (comparator == null) ? new TreeMultiset((Comparator) Ordering.natural()) @@ -263,7 +268,7 @@ static int distinctElements(@CheckForNull AvlNode node) { @CanIgnoreReturnValue @Override - public int add(@ParametricNullness E element, int occurrences) { + public int add(@Mutable TreeMultiset this, @ParametricNullness E element, int occurrences) { checkNonnegative(occurrences, "occurrences"); if (occurrences == 0) { return count(element); @@ -285,7 +290,7 @@ public int add(@ParametricNullness E element, int occurrences) { @CanIgnoreReturnValue @Override - public int remove(@CheckForNull Object element, int occurrences) { + public int remove(@Mutable TreeMultiset this, @CheckForNull Object element, int occurrences) { checkNonnegative(occurrences, "occurrences"); if (occurrences == 0) { return count(element); @@ -309,7 +314,7 @@ public int remove(@CheckForNull Object element, int occurrences) { @CanIgnoreReturnValue @Override - public int setCount(@ParametricNullness E element, int count) { + public int setCount(@Mutable TreeMultiset this, @ParametricNullness E element, int count) { checkNonnegative(count, "count"); if (!range.contains(element)) { checkArgument(count == 0); @@ -331,7 +336,7 @@ public int setCount(@ParametricNullness E element, int count) { @CanIgnoreReturnValue @Override - public boolean setCount(@ParametricNullness E element, int oldCount, int newCount) { + public boolean setCount(@Mutable TreeMultiset this, @ParametricNullness E element, int oldCount, int newCount) { checkNonnegative(newCount, "newCount"); checkNonnegative(oldCount, "oldCount"); checkArgument(range.contains(element)); @@ -354,7 +359,7 @@ public boolean setCount(@ParametricNullness E element, int oldCount, int newCoun } @Override - public void clear() { + public void clear(@Mutable TreeMultiset this) { if (!range.hasLowerBound() && !range.hasUpperBound()) { // We can do this in O(n) rather than removing one by one, which could force rebalancing. for (AvlNode current = header.succ(); current != header; ) { @@ -589,7 +594,7 @@ void clear() { } } - private static final class AvlNode { + private @ReceiverDependentMutable static final class AvlNode { /* * For "normal" nodes, the type of this field is `E`, not `@Nullable E` (though note that E is a * type that can include null, as in a TreeMultiset<@Nullable String>). @@ -603,11 +608,11 @@ private static final class AvlNode { @CheckForNull private final E elem; // elemCount is 0 iff this node has been deleted. - private int elemCount; + private @Assignable int elemCount; - private int distinctElements; - private long totalCount; - private int height; + private @Assignable int distinctElements; + private @Assignable long totalCount; + private @Assignable int height; @CheckForNull private AvlNode left; @CheckForNull private AvlNode right; /* @@ -1059,12 +1064,12 @@ public String toString() { } } - private static void successor(AvlNode a, AvlNode b) { + private static void successor(AvlNode a, AvlNode b) { a.succ = b; b.pred = a; } - private static void successor( + private static void successor( AvlNode a, AvlNode b, AvlNode c) { successor(a, b); successor(b, c); diff --git a/guava/src/com/google/common/collect/TreeRangeMap.java b/guava/src/com/google/common/collect/TreeRangeMap.java index bde057238026..71507385f8ca 100644 --- a/guava/src/com/google/common/collect/TreeRangeMap.java +++ b/guava/src/com/google/common/collect/TreeRangeMap.java @@ -43,6 +43,10 @@ import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -57,11 +61,12 @@ @Beta @GwtIncompatible // NavigableMap @ElementTypesAreNonnullByDefault -public final class TreeRangeMap implements RangeMap { +@ReceiverDependentMutable +public final class TreeRangeMap implements RangeMap { private final NavigableMap, RangeMapEntry> entriesByLowerBound; - public static TreeRangeMap create() { + public static TreeRangeMap create() { return new TreeRangeMap<>(); } @@ -69,7 +74,8 @@ private TreeRangeMap() { this.entriesByLowerBound = Maps.newTreeMap(); } - private static final class RangeMapEntry + @Immutable + private static final class RangeMapEntry extends AbstractMapEntry, V> { private final Range range; private final V value; @@ -84,24 +90,24 @@ private static final class RangeMapEntry } @Override - public Range getKey() { + public Range getKey(@Readonly RangeMapEntry this) { return range; } @Override - public V getValue() { + public V getValue(@Readonly RangeMapEntry this) { return value; } - public boolean contains(K value) { + public boolean contains(@Readonly RangeMapEntry this, K value) { return range.contains(value); } - Cut getLowerBound() { + Cut getLowerBound(@Readonly RangeMapEntry this) { return range.lowerBound; } - Cut getUpperBound() { + Cut getUpperBound(@Readonly RangeMapEntry this) { return range.upperBound; } } @@ -115,8 +121,8 @@ public V get(K key) { @Override @CheckForNull - public Entry, V> getEntry(K key) { - Entry, RangeMapEntry> mapEntry = + public Entry<@Immutable Range, V> getEntry(K key) { + Entry<@Immutable Cut, RangeMapEntry> mapEntry = entriesByLowerBound.floorEntry(Cut.belowValue(key)); if (mapEntry != null && mapEntry.getValue().contains(key)) { return mapEntry.getValue(); @@ -161,8 +167,8 @@ private Range coalescedRange(Range range, V value) { } /** Returns the range that spans the given range and entry, if the entry can be coalesced. */ - private static Range coalesce( - Range range, V value, @CheckForNull Entry, RangeMapEntry> entry) { + private static Range coalesce( + Range range, V value, @CheckForNull Entry<@Immutable Cut, RangeMapEntry> entry) { if (entry != null && entry.getValue().getKey().isConnected(range) && entry.getValue().getValue().equals(value)) { @@ -173,7 +179,7 @@ private static Range coalesce( @Override public void putAll(RangeMap rangeMap) { - for (Entry, V> entry : rangeMap.asMapOfRanges().entrySet()) { + for (Entry<@Immutable Range, V> entry : rangeMap.asMapOfRanges().entrySet()) { put(entry.getKey(), entry.getValue()); } } @@ -185,8 +191,8 @@ public void clear() { @Override public Range span() { - Entry, RangeMapEntry> firstEntry = entriesByLowerBound.firstEntry(); - Entry, RangeMapEntry> lastEntry = entriesByLowerBound.lastEntry(); + Entry<@Immutable Cut, RangeMapEntry> firstEntry = entriesByLowerBound.firstEntry(); + Entry<@Immutable Cut, RangeMapEntry> lastEntry = entriesByLowerBound.lastEntry(); // Either both are null or neither is, but we check both to satisfy the nullness checker. if (firstEntry == null || lastEntry == null) { throw new NoSuchElementException(); @@ -333,23 +339,24 @@ public Map, V> asDescendingMapOfRanges() { return new AsMapOfRanges(entriesByLowerBound.descendingMap().values()); } + @ReceiverDependentMutable private final class AsMapOfRanges extends IteratorBasedAbstractMap, V> { final Iterable, V>> entryIterable; @SuppressWarnings("unchecked") // it's safe to upcast iterables - AsMapOfRanges(Iterable> entryIterable) { + AsMapOfRanges(@ReceiverDependentMutable Iterable> entryIterable) { this.entryIterable = (Iterable) entryIterable; } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return get(key) != null; } @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { if (key instanceof Range) { Range range = (Range) key; RangeMapEntry rangeMapEntry = entriesByLowerBound.get(range.lowerBound); @@ -386,6 +393,7 @@ private RangeMap emptySubRangeMap() { } @SuppressWarnings("ConstantCaseForConstants") // This RangeMap is immutable. + @Immutable private static final RangeMap, Object> EMPTY_SUB_RANGE_MAP = new RangeMap, Object>() { @Override @@ -492,7 +500,7 @@ public Entry, V> getEntry(K key) { @Override public Range span() { Cut lowerBound; - Entry, RangeMapEntry> lowerEntry = + Entry<@Immutable Cut, RangeMapEntry> lowerEntry = entriesByLowerBound.floorEntry(subRange.lowerBound); if (lowerEntry != null && lowerEntry.getValue().getUpperBound().compareTo(subRange.lowerBound) > 0) { @@ -505,7 +513,7 @@ public Range span() { } Cut upperBound; - Entry, RangeMapEntry> upperEntry = + Entry<@Immutable Cut, RangeMapEntry> upperEntry = entriesByLowerBound.lowerEntry(subRange.upperBound); if (upperEntry == null) { throw new NoSuchElementException(); @@ -645,13 +653,13 @@ public String toString() { class SubRangeMapAsMap extends AbstractMap, V> { @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return get(key) != null; } @Override @CheckForNull - public V get(@CheckForNull @UnknownSignedness Object key) { + public V get(@CheckForNull @UnknownSignedness @Readonly Object key) { try { if (key instanceof Range) { @SuppressWarnings("unchecked") // we catch ClassCastExceptions @@ -662,7 +670,7 @@ public V get(@CheckForNull @UnknownSignedness Object key) { RangeMapEntry candidate = null; if (r.lowerBound.compareTo(subRange.lowerBound) == 0) { // r could be truncated on the left - Entry, RangeMapEntry> entry = + Entry<@Immutable Cut, RangeMapEntry> entry = entriesByLowerBound.floorEntry(r.lowerBound); if (entry != null) { candidate = entry.getValue(); @@ -685,7 +693,7 @@ public V get(@CheckForNull @UnknownSignedness Object key) { @Override @CheckForNull - public V remove(@CheckForNull @UnknownSignedness Object key) { + public V remove(@CheckForNull @UnknownSignedness @Readonly Object key) { V value = get(key); if (value != null) { // it's definitely in the map, so the cast and requireNonNull are safe @@ -760,7 +768,7 @@ public boolean isEmpty() { }; } - Iterator, V>> entryIterator() { + Iterator, V>> entryIterator(@Readonly SubRangeMapAsMap this) { if (subRange.isEmpty()) { return Iterators.emptyIterator(); } @@ -789,7 +797,7 @@ protected Entry, V> computeNext() { } @Override - public Collection values() { + public @PolyMutable Collection values(@PolyMutable SubRangeMapAsMap this) { return new Maps.Values, V>(this) { @Override public boolean removeAll(Collection c) { @@ -806,7 +814,7 @@ public boolean retainAll(Collection c) { } @Override - public boolean equals(@CheckForNull Object o) { + public boolean equals(@Readonly TreeRangeMap this, @CheckForNull @Readonly Object o) { if (o instanceof RangeMap) { RangeMap rangeMap = (RangeMap) o; return asMapOfRanges().equals(rangeMap.asMapOfRanges()); @@ -815,12 +823,12 @@ public boolean equals(@CheckForNull Object o) { } @Override - public int hashCode(@UnknownSignedness TreeRangeMap this) { + public int hashCode(@UnknownSignedness @Readonly TreeRangeMap this) { return asMapOfRanges().hashCode(); } @Override - public String toString() { + public String toString(@Readonly TreeRangeMap this) { return entriesByLowerBound.values().toString(); } } diff --git a/guava/src/com/google/common/collect/TreeRangeSet.java b/guava/src/com/google/common/collect/TreeRangeSet.java index d82f5423a914..995971a77fec 100644 --- a/guava/src/com/google/common/collect/TreeRangeSet.java +++ b/guava/src/com/google/common/collect/TreeRangeSet.java @@ -32,7 +32,13 @@ import java.util.TreeMap; import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.CFComment; /** * An implementation of {@link RangeSet} backed by a {@link TreeMap}. @@ -43,18 +49,19 @@ @Beta @GwtIncompatible // uses NavigableMap @ElementTypesAreNonnullByDefault -public class TreeRangeSet> extends AbstractRangeSet +@ReceiverDependentMutable +public class TreeRangeSet> extends AbstractRangeSet implements Serializable { @VisibleForTesting final NavigableMap, Range> rangesByLowerBound; /** Creates an empty {@code TreeRangeSet} instance. */ - public static > TreeRangeSet create() { + public static > TreeRangeSet create() { return new TreeRangeSet<>(new TreeMap, Range>()); } /** Returns a {@code TreeRangeSet} initialized with the ranges in the specified range set. */ - public static > TreeRangeSet create(RangeSet rangeSet) { + public static > TreeRangeSet create(RangeSet rangeSet) { TreeRangeSet result = create(); result.addAll(rangeSet); return result; @@ -69,7 +76,7 @@ public static > TreeRangeSet create(RangeSet range * * @since 21.0 */ - public static > TreeRangeSet create(Iterable> ranges) { + public static > TreeRangeSet create(Iterable> ranges) { TreeRangeSet result = create(); result.addAll(ranges); return result; @@ -79,43 +86,45 @@ private TreeRangeSet(NavigableMap, Range> rangesByLowerCut) { this.rangesByLowerBound = rangesByLowerCut; } - @CheckForNull private transient Set> asRanges; - @CheckForNull private transient Set> asDescendingSetOfRanges; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable Set> asRanges; + @CheckForNull private transient @Assignable Set> asDescendingSetOfRanges; @Override - public Set> asRanges() { + public @PolyMutable Set> asRanges(@PolyMutable TreeRangeSet this) { Set> result = asRanges; return (result == null) ? asRanges = new AsRanges(rangesByLowerBound.values()) : result; } @Override - public Set> asDescendingSetOfRanges() { + public @PolyMutable Set> asDescendingSetOfRanges(@PolyMutable TreeRangeSet this) { Set> result = asDescendingSetOfRanges; return (result == null) ? asDescendingSetOfRanges = new AsRanges(rangesByLowerBound.descendingMap().values()) : result; } + @ReceiverDependentMutable final class AsRanges extends ForwardingCollection> implements Set> { final Collection> delegate; - AsRanges(Collection> delegate) { + AsRanges(@ReceiverDependentMutable Collection> delegate) { this.delegate = delegate; } @Override - protected Collection> delegate() { + protected @PolyMutable Collection> delegate(@PolyMutable AsRanges this) { return delegate; } @Override - public int hashCode(@UnknownSignedness AsRanges this) { + public int hashCode(@UnknownSignedness @Readonly AsRanges this) { return Sets.hashCodeImpl(this); } @Override - public boolean equals(@CheckForNull @UnknownSignedness Object o) { + public boolean equals(@Readonly AsRanges this, @CheckForNull @UnknownSignedness @Readonly Object o) { return Sets.equalsImpl(this, o); } } @@ -136,13 +145,13 @@ public Range rangeContaining(C value) { @Override public boolean intersects(Range range) { checkNotNull(range); - Entry, Range> ceilingEntry = rangesByLowerBound.ceilingEntry(range.lowerBound); + Entry<@Immutable Cut, Range> ceilingEntry = rangesByLowerBound.ceilingEntry(range.lowerBound); if (ceilingEntry != null && ceilingEntry.getValue().isConnected(range) && !ceilingEntry.getValue().intersection(range).isEmpty()) { return true; } - Entry, Range> priorEntry = rangesByLowerBound.lowerEntry(range.lowerBound); + Entry<@Immutable Cut, Range> priorEntry = rangesByLowerBound.lowerEntry(range.lowerBound); return priorEntry != null && priorEntry.getValue().isConnected(range) && !priorEntry.getValue().intersection(range).isEmpty(); @@ -151,23 +160,23 @@ public boolean intersects(Range range) { @Override public boolean encloses(Range range) { checkNotNull(range); - Entry, Range> floorEntry = rangesByLowerBound.floorEntry(range.lowerBound); + Entry<@Immutable Cut, Range> floorEntry = rangesByLowerBound.floorEntry(range.lowerBound); return floorEntry != null && floorEntry.getValue().encloses(range); } @CheckForNull private Range rangeEnclosing(Range range) { checkNotNull(range); - Entry, Range> floorEntry = rangesByLowerBound.floorEntry(range.lowerBound); + Entry<@Immutable Cut, Range> floorEntry = rangesByLowerBound.floorEntry(range.lowerBound); return (floorEntry != null && floorEntry.getValue().encloses(range)) ? floorEntry.getValue() : null; } @Override - public Range span() { - Entry, Range> firstEntry = rangesByLowerBound.firstEntry(); - Entry, Range> lastEntry = rangesByLowerBound.lastEntry(); + public Range span(@Readonly TreeRangeSet this) { + Entry<@Immutable Cut, Range> firstEntry = rangesByLowerBound.firstEntry(); + Entry<@Immutable Cut, Range> lastEntry = rangesByLowerBound.lastEntry(); if (firstEntry == null || lastEntry == null) { /* * Either both are null or neither is: Either the set is empty, or it's not. But we check both @@ -191,7 +200,7 @@ public void add(Range rangeToAdd) { Cut lbToAdd = rangeToAdd.lowerBound; Cut ubToAdd = rangeToAdd.upperBound; - Entry, Range> entryBelowLB = rangesByLowerBound.lowerEntry(lbToAdd); + Entry<@Immutable Cut, Range> entryBelowLB = rangesByLowerBound.lowerEntry(lbToAdd); if (entryBelowLB != null) { // { < Range rangeBelowLB = entryBelowLB.getValue(); @@ -209,7 +218,7 @@ public void add(Range rangeToAdd) { } } - Entry, Range> entryBelowUB = rangesByLowerBound.floorEntry(ubToAdd); + Entry<@Immutable Cut, Range> entryBelowUB = rangesByLowerBound.floorEntry(ubToAdd); if (entryBelowUB != null) { // { > Range rangeBelowUB = entryBelowUB.getValue(); @@ -236,7 +245,7 @@ public void remove(Range rangeToRemove) { // We will use { } to illustrate ranges currently in the range set, and < > // to illustrate rangeToRemove. - Entry, Range> entryBelowLB = rangesByLowerBound.lowerEntry(rangeToRemove.lowerBound); + Entry<@Immutable Cut, Range> entryBelowLB = rangesByLowerBound.lowerEntry(rangeToRemove.lowerBound); if (entryBelowLB != null) { // { < Range rangeBelowLB = entryBelowLB.getValue(); @@ -276,16 +285,18 @@ private void replaceRangeWithSameLowerBound(Range range) { } } - @CheckForNull private transient RangeSet complement; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable RangeSet complement; @Override - public RangeSet complement() { + public RangeSet complement(@PolyMutable TreeRangeSet this) { RangeSet result = complement; return (result == null) ? complement = new Complement() : result; } @VisibleForTesting - static final class RangesByUpperBound> + @ReceiverDependentMutable + static final class RangesByUpperBound> extends AbstractNavigableMap, Range> { private final NavigableMap, Range> rangesByLowerBound; @@ -339,13 +350,13 @@ public Comparator> comparator() { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return get(key) != null; } @Override @CheckForNull - public Range get(@CheckForNull @UnknownSignedness Object key) { + public Range get(@CheckForNull @UnknownSignedness @Readonly Object key) { if (key instanceof Cut) { try { @SuppressWarnings("unchecked") // we catch CCEs @@ -453,7 +464,8 @@ public boolean isEmpty() { } } - private static final class ComplementRangesByLowerBound> + @ReceiverDependentMutable + private static final class ComplementRangesByLowerBound> extends AbstractNavigableMap, Range> { private final NavigableMap, Range> positiveRangesByLowerBound; private final NavigableMap, Range> positiveRangesByUpperBound; @@ -635,7 +647,7 @@ protected Entry, Range> computeNext() { @Override @CheckForNull - public Range get(@CheckForNull @UnknownSignedness Object key) { + public Range get(@CheckForNull @UnknownSignedness @Readonly Object key) { if (key instanceof Cut) { try { @SuppressWarnings("unchecked") @@ -653,11 +665,12 @@ public Range get(@CheckForNull @UnknownSignedness Object key) { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return get(key) != null; } } + @ReceiverDependentMutable private final class Complement extends TreeRangeSet { Complement() { super(new ComplementRangesByLowerBound(TreeRangeSet.this.rangesByLowerBound)); @@ -684,7 +697,8 @@ public RangeSet complement() { } } - private static final class SubRangeSetRangesByLowerBound> + @ReceiverDependentMutable + private static final class SubRangeSetRangesByLowerBound> extends AbstractNavigableMap, Range> { /** * lowerBoundWindow is the headMap/subMap/tailMap view; it only restricts the keys, and does not @@ -747,13 +761,13 @@ public Comparator> comparator() { } @Override - public boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + public boolean containsKey(@CheckForNull @UnknownSignedness @Readonly Object key) { return get(key) != null; } @Override @CheckForNull - public Range get(@CheckForNull @UnknownSignedness Object key) { + public Range get(@CheckForNull @UnknownSignedness @Readonly Object key) { if (key instanceof Cut) { try { @SuppressWarnings("unchecked") // we catch CCE's @@ -872,6 +886,7 @@ public RangeSet subRangeSet(Range view) { return view.equals(Range.all()) ? this : new SubRangeSet(view); } + @ReceiverDependentMutable private final class SubRangeSet extends TreeRangeSet { private final Range restriction; diff --git a/guava/src/com/google/common/collect/TreeTraverser.java b/guava/src/com/google/common/collect/TreeTraverser.java index b5d2a4293ffa..c01ca5d6781a 100644 --- a/guava/src/com/google/common/collect/TreeTraverser.java +++ b/guava/src/com/google/common/collect/TreeTraverser.java @@ -76,6 +76,7 @@ @Beta @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class TreeTraverser { /** diff --git a/guava/src/com/google/common/collect/UnmodifiableIterator.java b/guava/src/com/google/common/collect/UnmodifiableIterator.java index 3ee09456d175..8453e2e6aa56 100644 --- a/guava/src/com/google/common/collect/UnmodifiableIterator.java +++ b/guava/src/com/google/common/collect/UnmodifiableIterator.java @@ -20,7 +20,10 @@ import com.google.errorprone.annotations.DoNotCall; import java.util.Iterator; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * An iterator that does not support {@link #remove}. @@ -32,10 +35,12 @@ * @author Jared Levy * @since 2.0 */ -@AnnotatedFor({"nullness"}) +@AnnotatedFor({"nullness", "pico"}) @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class UnmodifiableIterator implements Iterator { +@Immutable +@CFComment("PICO: wait, so unmodifiable means can still do next but can not do remove?") +public abstract class UnmodifiableIterator implements Iterator { /** Constructor for use by subclasses. */ protected UnmodifiableIterator() {} diff --git a/guava/src/com/google/common/collect/UnmodifiableListIterator.java b/guava/src/com/google/common/collect/UnmodifiableListIterator.java index f3d3b921b7dc..9e15bb95aabd 100644 --- a/guava/src/com/google/common/collect/UnmodifiableListIterator.java +++ b/guava/src/com/google/common/collect/UnmodifiableListIterator.java @@ -20,6 +20,9 @@ import com.google.errorprone.annotations.DoNotCall; import java.util.ListIterator; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A list iterator that does not support {@link #remove}, {@link #add}, or {@link #set}. @@ -27,9 +30,11 @@ * @since 7.0 * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault -public abstract class UnmodifiableListIterator +@Immutable +public abstract class UnmodifiableListIterator extends UnmodifiableIterator implements ListIterator { /** Constructor for use by subclasses. */ protected UnmodifiableListIterator() {} diff --git a/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java b/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java index 31f3c7197776..110a5f803059 100644 --- a/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java +++ b/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java @@ -22,6 +22,11 @@ import java.util.NavigableSet; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Assignable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.CFComment; /** * Implementation of {@link Multisets#unmodifiableSortedMultiset(SortedMultiset)}, split out into @@ -30,38 +35,41 @@ * * @author Louis Wasserman */ +@AnnotatedFor("pico") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault -final class UnmodifiableSortedMultiset extends UnmodifiableMultiset +@Immutable +final class UnmodifiableSortedMultiset extends UnmodifiableMultiset implements SortedMultiset { - UnmodifiableSortedMultiset(SortedMultiset delegate) { + UnmodifiableSortedMultiset(@Readonly SortedMultiset delegate) { super(delegate); } @Override - protected SortedMultiset delegate() { - return (SortedMultiset) super.delegate(); + protected @Readonly SortedMultiset delegate(@Readonly UnmodifiableSortedMultiset this) { + return (@Readonly SortedMultiset) super.delegate(); } @Override - public Comparator comparator() { + public Comparator comparator(@Readonly UnmodifiableSortedMultiset this) { return delegate().comparator(); } @Override - NavigableSet createElementSet() { + @Readonly NavigableSet createElementSet(@Readonly UnmodifiableSortedMultiset this) { return Sets.unmodifiableNavigableSet(delegate().elementSet()); } @Override - public NavigableSet elementSet() { + public @Readonly NavigableSet elementSet(@Readonly UnmodifiableSortedMultiset this) { return (NavigableSet) super.elementSet(); } - @CheckForNull private transient UnmodifiableSortedMultiset descendingMultiset; + @CFComment("Change to @LazyFinal later") + @CheckForNull private transient @Assignable UnmodifiableSortedMultiset descendingMultiset; @Override - public SortedMultiset descendingMultiset() { + public @Readonly SortedMultiset descendingMultiset(@Readonly UnmodifiableSortedMultiset this) { UnmodifiableSortedMultiset result = descendingMultiset; if (result == null) { result = new UnmodifiableSortedMultiset<>(delegate().descendingMultiset()); @@ -73,13 +81,13 @@ public SortedMultiset descendingMultiset() { @Override @CheckForNull - public Entry firstEntry() { + public @Readonly Entry firstEntry(@Readonly UnmodifiableSortedMultiset this) { return delegate().firstEntry(); } @Override @CheckForNull - public Entry lastEntry() { + public @Readonly Entry lastEntry(@Readonly UnmodifiableSortedMultiset this) { return delegate().lastEntry(); } @@ -96,12 +104,13 @@ public Entry pollLastEntry() { } @Override - public SortedMultiset headMultiset(@ParametricNullness E upperBound, BoundType boundType) { + public @Readonly SortedMultiset headMultiset(@Readonly UnmodifiableSortedMultiset this, @ParametricNullness E upperBound, BoundType boundType) { return Multisets.unmodifiableSortedMultiset(delegate().headMultiset(upperBound, boundType)); } @Override - public SortedMultiset subMultiset( + public @Readonly SortedMultiset subMultiset( + @Readonly UnmodifiableSortedMultiset this, @ParametricNullness E lowerBound, BoundType lowerBoundType, @ParametricNullness E upperBound, @@ -111,7 +120,7 @@ public SortedMultiset subMultiset( } @Override - public SortedMultiset tailMultiset(@ParametricNullness E lowerBound, BoundType boundType) { + public @Readonly SortedMultiset tailMultiset(@Readonly UnmodifiableSortedMultiset this, @ParametricNullness E lowerBound, BoundType boundType) { return Multisets.unmodifiableSortedMultiset(delegate().tailMultiset(lowerBound, boundType)); } diff --git a/guava/src/com/google/common/collect/UsingToStringOrdering.java b/guava/src/com/google/common/collect/UsingToStringOrdering.java index 70ad6fa2c419..09920c55363d 100644 --- a/guava/src/com/google/common/collect/UsingToStringOrdering.java +++ b/guava/src/com/google/common/collect/UsingToStringOrdering.java @@ -18,9 +18,12 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.dataflow.qual.Pure; +import org.checkerframework.framework.qual.AnnotatedFor; /** An ordering that uses the natural order of the string representation of the values. */ +@AnnotatedFor("pico") @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault final class UsingToStringOrdering extends Ordering implements Serializable { @@ -28,7 +31,7 @@ final class UsingToStringOrdering extends Ordering implements Serializab @Pure @Override - public int compare(Object left, Object right) { + public int compare(@Readonly Object left, @Readonly Object right) { return left.toString().compareTo(right.toString()); } diff --git a/guava/src/com/google/common/escape/Escapers.java b/guava/src/com/google/common/escape/Escapers.java index 3d6ac9ef1d5b..1509ed604eb3 100644 --- a/guava/src/com/google/common/escape/Escapers.java +++ b/guava/src/com/google/common/escape/Escapers.java @@ -33,6 +33,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Escapers { private Escapers() {} diff --git a/guava/src/com/google/common/escape/UnicodeEscaper.java b/guava/src/com/google/common/escape/UnicodeEscaper.java index 34690ea08f43..5ddaf229de33 100644 --- a/guava/src/com/google/common/escape/UnicodeEscaper.java +++ b/guava/src/com/google/common/escape/UnicodeEscaper.java @@ -24,6 +24,8 @@ import org.checkerframework.checker.index.qual.LengthOf; import org.checkerframework.checker.index.qual.LessThan; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * An {@link Escaper} that converts literal text into a format safe for inclusion in a particular @@ -55,6 +57,7 @@ * @author David Beaumont * @since 15.0 */ +@AnnotatedFor("pico") @GwtCompatible @ElementTypesAreNonnullByDefault public abstract class UnicodeEscaper extends Escaper { @@ -134,7 +137,7 @@ public String escape(String string) { * @throws IllegalArgumentException if the scanned sub-sequence of {@code csq} contains invalid * surrogate pairs */ - protected @IndexOrHigh("#1") int nextEscapeIndex(CharSequence csq, @IndexOrHigh("#1") int start, @IndexOrHigh("#1") int end) { + protected @IndexOrHigh("#1") int nextEscapeIndex(@Readonly CharSequence csq, @IndexOrHigh("#1") int start, @IndexOrHigh("#1") int end) { @IndexOrHigh("#1") int index = start; while (index < end) { int cp = codePointAt(csq, index, end); @@ -161,6 +164,7 @@ public String escape(String string) { * @throws NullPointerException if {@code string} is null * @throws IllegalArgumentException if invalid surrogate characters are encountered */ + @SuppressWarnings("pico:argument.type.incompatible") // cast from @Unique @Mutable to @Immutable protected final String escapeSlow(String s, @IndexOrHigh("#1") int index) { int end = s.length(); @@ -249,7 +253,7 @@ protected final String escapeSlow(String s, @IndexOrHigh("#1") int index) { * @return the Unicode code point for the given index or the negated value of the trailing high * surrogate character at the end of the sequence */ - protected static int codePointAt(CharSequence seq, @IndexFor("#1") int index, @IndexOrHigh("#1") int end) { + protected static int codePointAt(@Readonly CharSequence seq, @IndexFor("#1") int index, @IndexOrHigh("#1") int end) { checkNotNull(seq); @IndexOrHigh("seq") int indexInternal = index; if (indexInternal < end) { diff --git a/guava/src/com/google/common/eventbus/SubscriberRegistry.java b/guava/src/com/google/common/eventbus/SubscriberRegistry.java index c9df205fa76a..22290401265c 100644 --- a/guava/src/com/google/common/eventbus/SubscriberRegistry.java +++ b/guava/src/com/google/common/eventbus/SubscriberRegistry.java @@ -55,6 +55,7 @@ * @author Colin Decker */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class SubscriberRegistry { /** diff --git a/guava/src/com/google/common/graph/AbstractBaseGraph.java b/guava/src/com/google/common/graph/AbstractBaseGraph.java index 3cecb5dc6fbe..0feff756848a 100644 --- a/guava/src/com/google/common/graph/AbstractBaseGraph.java +++ b/guava/src/com/google/common/graph/AbstractBaseGraph.java @@ -44,6 +44,7 @@ * @param Node parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") abstract class AbstractBaseGraph implements BaseGraph { /** diff --git a/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java b/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java index 8d2d1450cea8..38307ca32bdd 100644 --- a/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java +++ b/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java @@ -44,6 +44,7 @@ * @param Edge parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") abstract class AbstractDirectedNetworkConnections implements NetworkConnections { /** Keys are edges incoming to the origin node, values are the source node. */ final Map inEdgeMap; diff --git a/guava/src/com/google/common/graph/AbstractNetwork.java b/guava/src/com/google/common/graph/AbstractNetwork.java index 0dc773b6fa4e..bc3c19939bbd 100644 --- a/guava/src/com/google/common/graph/AbstractNetwork.java +++ b/guava/src/com/google/common/graph/AbstractNetwork.java @@ -54,6 +54,7 @@ */ @Beta @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class AbstractNetwork implements Network { @Override diff --git a/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java b/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java index 8f736d7baa23..180de3b4e0ff 100644 --- a/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java +++ b/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java @@ -33,6 +33,7 @@ * @param Edge parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") abstract class AbstractUndirectedNetworkConnections implements NetworkConnections { /** Keys are edges incident to the origin node, values are the node at the other end. */ final Map incidentEdgeMap; diff --git a/guava/src/com/google/common/graph/DirectedGraphConnections.java b/guava/src/com/google/common/graph/DirectedGraphConnections.java index e58a772970aa..3791b21892f3 100644 --- a/guava/src/com/google/common/graph/DirectedGraphConnections.java +++ b/guava/src/com/google/common/graph/DirectedGraphConnections.java @@ -43,6 +43,8 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -54,7 +56,8 @@ * @param Value parameter type */ @ElementTypesAreNonnullByDefault -final class DirectedGraphConnections implements GraphConnections { +@SuppressWarnings("pico") +final class DirectedGraphConnections implements GraphConnections { /** * A wrapper class to indicate a node is both a predecessor and successor while still providing * the successor value. @@ -86,7 +89,7 @@ static final class Pred extends NodeConnection { } @Override - public boolean equals(@CheckForNull Object that) { + public boolean equals(@CheckForNull @Readonly Object that) { if (that instanceof Pred) { return this.node.equals(((Pred) that).node); } else { @@ -95,7 +98,7 @@ public boolean equals(@CheckForNull Object that) { } @Override - public int hashCode(@UnknownSignedness Pred this) { + public int hashCode(@UnknownSignedness @Readonly Pred this) { // Adding the class hashCode to avoid a clash with Succ instances. return Pred.class.hashCode() + node.hashCode(); } diff --git a/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java b/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java index 3f2195fca519..18eb6d3199f4 100644 --- a/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java +++ b/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java @@ -41,6 +41,7 @@ * @param Edge parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class DirectedMultiNetworkConnections extends AbstractDirectedNetworkConnections { private DirectedMultiNetworkConnections( diff --git a/guava/src/com/google/common/graph/DirectedNetworkConnections.java b/guava/src/com/google/common/graph/DirectedNetworkConnections.java index e1db65708eb0..839f4d76508d 100644 --- a/guava/src/com/google/common/graph/DirectedNetworkConnections.java +++ b/guava/src/com/google/common/graph/DirectedNetworkConnections.java @@ -33,6 +33,7 @@ * @param Edge parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class DirectedNetworkConnections extends AbstractDirectedNetworkConnections { DirectedNetworkConnections(Map inEdgeMap, Map outEdgeMap, int selfLoopCount) { diff --git a/guava/src/com/google/common/graph/ElementOrder.java b/guava/src/com/google/common/graph/ElementOrder.java index 24a0c1de65a9..5434f5bb14ac 100644 --- a/guava/src/com/google/common/graph/ElementOrder.java +++ b/guava/src/com/google/common/graph/ElementOrder.java @@ -48,6 +48,7 @@ @Beta @Immutable @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class ElementOrder { private final Type type; diff --git a/guava/src/com/google/common/graph/EndpointPairIterator.java b/guava/src/com/google/common/graph/EndpointPairIterator.java index 7096dbe3da2a..b1fe1a7426eb 100644 --- a/guava/src/com/google/common/graph/EndpointPairIterator.java +++ b/guava/src/com/google/common/graph/EndpointPairIterator.java @@ -33,6 +33,7 @@ * @author James Sexton */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") abstract class EndpointPairIterator extends AbstractIterator> { private final BaseGraph graph; private final Iterator nodeIterator; diff --git a/guava/src/com/google/common/graph/Graphs.java b/guava/src/com/google/common/graph/Graphs.java index 6ab9f5661557..44aed9246168 100644 --- a/guava/src/com/google/common/graph/Graphs.java +++ b/guava/src/com/google/common/graph/Graphs.java @@ -45,6 +45,7 @@ */ @Beta @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Graphs { private Graphs() {} diff --git a/guava/src/com/google/common/graph/ImmutableGraph.java b/guava/src/com/google/common/graph/ImmutableGraph.java index f829e9699993..df0c9888f424 100644 --- a/guava/src/com/google/common/graph/ImmutableGraph.java +++ b/guava/src/com/google/common/graph/ImmutableGraph.java @@ -46,6 +46,7 @@ @Beta @Immutable(containerOf = {"N"}) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public class ImmutableGraph extends ForwardingGraph { @SuppressWarnings("Immutable") // The backing graph must be immutable. private final BaseGraph backingGraph; diff --git a/guava/src/com/google/common/graph/ImmutableNetwork.java b/guava/src/com/google/common/graph/ImmutableNetwork.java index c29f8a392813..9fcded75d194 100644 --- a/guava/src/com/google/common/graph/ImmutableNetwork.java +++ b/guava/src/com/google/common/graph/ImmutableNetwork.java @@ -45,7 +45,7 @@ */ @Beta @Immutable(containerOf = {"N", "E"}) -@SuppressWarnings("Immutable") // Extends StandardNetwork but uses ImmutableMaps. +@SuppressWarnings({"Immutable", "pico"}) // Extends StandardNetwork but uses ImmutableMaps. @ElementTypesAreNonnullByDefault public final class ImmutableNetwork extends StandardNetwork { diff --git a/guava/src/com/google/common/graph/ImmutableValueGraph.java b/guava/src/com/google/common/graph/ImmutableValueGraph.java index eb17067fca43..8808922dfee5 100644 --- a/guava/src/com/google/common/graph/ImmutableValueGraph.java +++ b/guava/src/com/google/common/graph/ImmutableValueGraph.java @@ -43,7 +43,7 @@ */ @Beta @Immutable(containerOf = {"N", "V"}) -@SuppressWarnings("Immutable") // Extends StandardValueGraph but uses ImmutableMaps. +@SuppressWarnings({"Immutable", "pico"}) // Extends StandardValueGraph but uses ImmutableMaps. @ElementTypesAreNonnullByDefault public final class ImmutableValueGraph extends StandardValueGraph { diff --git a/guava/src/com/google/common/graph/MapIteratorCache.java b/guava/src/com/google/common/graph/MapIteratorCache.java index 4d9e67ad471c..f9df2570e138 100644 --- a/guava/src/com/google/common/graph/MapIteratorCache.java +++ b/guava/src/com/google/common/graph/MapIteratorCache.java @@ -28,7 +28,12 @@ import javax.annotation.CheckForNull; import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A map-like data structure that wraps a backing map and caches values while iterating through @@ -44,8 +49,10 @@ * * @author James Sexton */ +@AnnotatedFor("pico") @ElementTypesAreNonnullByDefault -class MapIteratorCache { +@ReceiverDependentMutable +class MapIteratorCache { private final Map backingMap; /* @@ -59,13 +66,13 @@ class MapIteratorCache { */ @CheckForNull private transient volatile Entry cacheEntry; - MapIteratorCache(Map backingMap) { + MapIteratorCache(@ReceiverDependentMutable Map backingMap) { this.backingMap = checkNotNull(backingMap); } @CanIgnoreReturnValue @CheckForNull - final V put(K key, V value) { + final V put(@Mutable MapIteratorCache this, K key, V value) { checkNotNull(key); checkNotNull(value); clearCache(); @@ -74,19 +81,19 @@ final V put(K key, V value) { @CanIgnoreReturnValue @CheckForNull - final V remove(Object key) { + final V remove(@Mutable MapIteratorCache this, @Readonly Object key) { checkNotNull(key); clearCache(); return backingMap.remove(key); } - final void clear() { + final void clear(@Mutable MapIteratorCache this) { clearCache(); backingMap.clear(); } @CheckForNull - V get(Object key) { + V get(@Readonly MapIteratorCache this, @Readonly Object key) { checkNotNull(key); V value = getIfCached(key); // TODO(b/192579700): Use a ternary once it no longer confuses our nullness checker. @@ -98,16 +105,16 @@ V get(Object key) { } @CheckForNull - final V getWithoutCaching(Object key) { + final V getWithoutCaching(@Readonly MapIteratorCache this, @Readonly Object key) { checkNotNull(key); return backingMap.get(key); } - final boolean containsKey(@CheckForNull @UnknownSignedness Object key) { + final boolean containsKey(@Readonly MapIteratorCache this, @CheckForNull @UnknownSignedness @Readonly Object key) { return getIfCached(key) != null || backingMap.containsKey(key); } - final Set unmodifiableKeySet() { + final @Readonly Set unmodifiableKeySet() { return new AbstractSet() { @Override public UnmodifiableIterator iterator() { @@ -134,7 +141,7 @@ public K next() { } @Override - public boolean contains(@CheckForNull @UnknownSignedness Object key) { + public boolean contains(@CheckForNull @UnknownSignedness @Readonly Object key) { return containsKey(key); } }; @@ -143,7 +150,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object key) { // Internal methods (package-visible, but treat as only subclass-visible) @CheckForNull - V getIfCached(@CheckForNull Object key) { + V getIfCached(@Readonly MapIteratorCache this, @CheckForNull @Readonly Object key) { Entry entry = cacheEntry; // store local reference for thread-safety // Check cache. We use == on purpose because it's cheaper and a cache miss is ok. @@ -153,7 +160,7 @@ V getIfCached(@CheckForNull Object key) { return null; } - void clearCache() { + void clearCache(@Mutable MapIteratorCache this) { cacheEntry = null; } } diff --git a/guava/src/com/google/common/graph/MapRetrievalCache.java b/guava/src/com/google/common/graph/MapRetrievalCache.java index ada78f28414d..fe3bac2524bc 100644 --- a/guava/src/com/google/common/graph/MapRetrievalCache.java +++ b/guava/src/com/google/common/graph/MapRetrievalCache.java @@ -28,6 +28,7 @@ * @author James Sexton */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class MapRetrievalCache extends MapIteratorCache { // See the note about volatile in the superclass. @CheckForNull private transient volatile CacheEntry cacheEntry1; diff --git a/guava/src/com/google/common/graph/MultiEdgesConnecting.java b/guava/src/com/google/common/graph/MultiEdgesConnecting.java index 141b97f76201..7daa53ce9463 100644 --- a/guava/src/com/google/common/graph/MultiEdgesConnecting.java +++ b/guava/src/com/google/common/graph/MultiEdgesConnecting.java @@ -38,6 +38,7 @@ * @param Edge parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") abstract class MultiEdgesConnecting extends AbstractSet { private final Map outEdgeToNode; diff --git a/guava/src/com/google/common/graph/StandardNetwork.java b/guava/src/com/google/common/graph/StandardNetwork.java index 2aa103f99683..5f94de8b6548 100644 --- a/guava/src/com/google/common/graph/StandardNetwork.java +++ b/guava/src/com/google/common/graph/StandardNetwork.java @@ -49,6 +49,7 @@ * @param Edge parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") class StandardNetwork extends AbstractNetwork { private final boolean isDirected; private final boolean allowsParallelEdges; diff --git a/guava/src/com/google/common/graph/StandardValueGraph.java b/guava/src/com/google/common/graph/StandardValueGraph.java index ab3ae582b55e..686eb16c550c 100644 --- a/guava/src/com/google/common/graph/StandardValueGraph.java +++ b/guava/src/com/google/common/graph/StandardValueGraph.java @@ -44,6 +44,7 @@ * @param Value parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") class StandardValueGraph extends AbstractValueGraph { private final boolean isDirected; private final boolean allowsSelfLoops; diff --git a/guava/src/com/google/common/graph/Traverser.java b/guava/src/com/google/common/graph/Traverser.java index fb594b440365..47f59d840d3e 100644 --- a/guava/src/com/google/common/graph/Traverser.java +++ b/guava/src/com/google/common/graph/Traverser.java @@ -65,6 +65,7 @@ "Call forGraph or forTree, passing a lambda or a Graph with the desired edges (built with" + " GraphBuilder)") @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class Traverser { private final SuccessorsFunction successorFunction; diff --git a/guava/src/com/google/common/graph/UndirectedGraphConnections.java b/guava/src/com/google/common/graph/UndirectedGraphConnections.java index 4eeb2328fe0e..89d52789acba 100644 --- a/guava/src/com/google/common/graph/UndirectedGraphConnections.java +++ b/guava/src/com/google/common/graph/UndirectedGraphConnections.java @@ -38,6 +38,7 @@ * @param Value parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class UndirectedGraphConnections implements GraphConnections { private final Map adjacentNodeValues; diff --git a/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java b/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java index e151ed3ee580..552d1127414d 100644 --- a/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java +++ b/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java @@ -41,6 +41,7 @@ * @param Edge parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class UndirectedMultiNetworkConnections extends AbstractUndirectedNetworkConnections { diff --git a/guava/src/com/google/common/graph/UndirectedNetworkConnections.java b/guava/src/com/google/common/graph/UndirectedNetworkConnections.java index 190897f8825d..62783afeebd4 100644 --- a/guava/src/com/google/common/graph/UndirectedNetworkConnections.java +++ b/guava/src/com/google/common/graph/UndirectedNetworkConnections.java @@ -33,6 +33,7 @@ * @param Edge parameter type */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class UndirectedNetworkConnections extends AbstractUndirectedNetworkConnections { UndirectedNetworkConnections(Map incidentEdgeMap) { diff --git a/guava/src/com/google/common/hash/BloomFilterStrategies.java b/guava/src/com/google/common/hash/BloomFilterStrategies.java index e20b398082c5..38f794a65635 100644 --- a/guava/src/com/google/common/hash/BloomFilterStrategies.java +++ b/guava/src/com/google/common/hash/BloomFilterStrategies.java @@ -41,6 +41,7 @@ * @author Kurt Alfred Kluever */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") enum BloomFilterStrategies implements BloomFilter.Strategy { /** * See "Less Hashing, Same Performance: Building a Better Bloom Filter" by Adam Kirsch and Michael diff --git a/guava/src/com/google/common/hash/Funnel.java b/guava/src/com/google/common/hash/Funnel.java index 9d80dabcf6ed..dd48dd2400be 100644 --- a/guava/src/com/google/common/hash/Funnel.java +++ b/guava/src/com/google/common/hash/Funnel.java @@ -18,6 +18,8 @@ import com.google.errorprone.annotations.DoNotMock; import java.io.Serializable; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * An object which can send data from an object of type {@code T} into a {@code PrimitiveSink}. @@ -42,10 +44,11 @@ * @author Dimitris Andreou * @since 11.0 */ +@AnnotatedFor("pico") @Beta @DoNotMock("Implement with a lambda") @ElementTypesAreNonnullByDefault -public interface Funnel extends Serializable { +public interface Funnel extends Serializable { /** * Sends a stream of data from the {@code from} object into the sink {@code into}. There is no diff --git a/guava/src/com/google/common/hash/Funnels.java b/guava/src/com/google/common/hash/Funnels.java index 62b3525b1d90..654865b998d0 100644 --- a/guava/src/com/google/common/hash/Funnels.java +++ b/guava/src/com/google/common/hash/Funnels.java @@ -37,6 +37,7 @@ */ @Beta @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Funnels { private Funnels() {} diff --git a/guava/src/com/google/common/hash/Hashing.java b/guava/src/com/google/common/hash/Hashing.java index 5c0d6789c978..c08502c9e03f 100644 --- a/guava/src/com/google/common/hash/Hashing.java +++ b/guava/src/com/google/common/hash/Hashing.java @@ -49,6 +49,7 @@ * @since 11.0 */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Hashing { /** * Returns a general-purpose, temporary-use, non-cryptographic hash function. The algorithm diff --git a/guava/src/com/google/common/hash/LittleEndianByteArray.java b/guava/src/com/google/common/hash/LittleEndianByteArray.java index a93a76ff63d9..decac6587bdd 100644 --- a/guava/src/com/google/common/hash/LittleEndianByteArray.java +++ b/guava/src/com/google/common/hash/LittleEndianByteArray.java @@ -27,6 +27,7 @@ * @author Kyle Maddison */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class LittleEndianByteArray { /** The instance that actually does the work; delegates to Unsafe or a pure-Java fallback. */ diff --git a/guava/src/com/google/common/io/AppendableWriter.java b/guava/src/com/google/common/io/AppendableWriter.java index 1e0c0ec9ad11..3ddcba729070 100644 --- a/guava/src/com/google/common/io/AppendableWriter.java +++ b/guava/src/com/google/common/io/AppendableWriter.java @@ -26,6 +26,9 @@ import org.checkerframework.checker.index.qual.LTLengthOf; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; +import org.checkerframework.framework.qual.AnnotatedFor; /** * Writer that places all output on an {@link Appendable} target. If the target is {@link Flushable} @@ -35,6 +38,7 @@ * @author Sebastian Kanthak * @since 1.0 */ +@AnnotatedFor("pico") @GwtIncompatible @ElementTypesAreNonnullByDefault class AppendableWriter extends Writer { @@ -55,7 +59,7 @@ class AppendableWriter extends Writer { */ @Override - public void write(char[] cbuf, @IndexOrHigh("#1") int off, @NonNegative @LTLengthOf(value = "#1", offset = "#2 - 1") int len) throws IOException { + public void write(char @Immutable [] cbuf, @IndexOrHigh("#1") int off, @NonNegative @LTLengthOf(value = "#1", offset = "#2 - 1") int len) throws IOException { checkNotClosed(); // It turns out that creating a new String is usually as fast, or faster // than wrapping cbuf in a light-weight CharSequence. @@ -111,14 +115,14 @@ public Writer append(char c) throws IOException { } @Override - public Writer append(@CheckForNull CharSequence charSeq) throws IOException { + public Writer append(@CheckForNull @Readonly CharSequence charSeq) throws IOException { checkNotClosed(); target.append(charSeq); return this; } @Override - public Writer append(@CheckForNull CharSequence charSeq, @IndexOrHigh("#1") int start, @IndexOrHigh("#1") int end) throws IOException { + public Writer append(@CheckForNull @Readonly CharSequence charSeq, @IndexOrHigh("#1") int start, @IndexOrHigh("#1") int end) throws IOException { checkNotClosed(); target.append(charSeq, start, end); return this; diff --git a/guava/src/com/google/common/io/BaseEncoding.java b/guava/src/com/google/common/io/BaseEncoding.java index 01f58a29d32a..48fa46ef5e08 100644 --- a/guava/src/com/google/common/io/BaseEncoding.java +++ b/guava/src/com/google/common/io/BaseEncoding.java @@ -134,6 +134,7 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class BaseEncoding { // TODO(lowasser): consider making encodeTo(Appendable, byte[], int, int) public. diff --git a/guava/src/com/google/common/io/ByteSource.java b/guava/src/com/google/common/io/ByteSource.java index 5e4fd4171fbb..4fef15381c85 100644 --- a/guava/src/com/google/common/io/ByteSource.java +++ b/guava/src/com/google/common/io/ByteSource.java @@ -78,6 +78,7 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class ByteSource { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/io/CharSink.java b/guava/src/com/google/common/io/CharSink.java index f804daeb7a38..3908a68e7870 100644 --- a/guava/src/com/google/common/io/CharSink.java +++ b/guava/src/com/google/common/io/CharSink.java @@ -52,6 +52,7 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class CharSink { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/io/CharSource.java b/guava/src/com/google/common/io/CharSource.java index 24a67af5c6e7..e97043c4c7c0 100644 --- a/guava/src/com/google/common/io/CharSource.java +++ b/guava/src/com/google/common/io/CharSource.java @@ -83,6 +83,7 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class CharSource { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/io/Files.java b/guava/src/com/google/common/io/Files.java index 046674c995af..57eaa4b40538 100644 --- a/guava/src/com/google/common/io/Files.java +++ b/guava/src/com/google/common/io/Files.java @@ -70,6 +70,7 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Files { /** Maximum loop count when creating temp directories. */ diff --git a/guava/src/com/google/common/math/BigIntegerMath.java b/guava/src/com/google/common/math/BigIntegerMath.java index c4d0823a9181..9a755cba55ff 100644 --- a/guava/src/com/google/common/math/BigIntegerMath.java +++ b/guava/src/com/google/common/math/BigIntegerMath.java @@ -38,6 +38,7 @@ import org.checkerframework.checker.index.qual.LessThan; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.index.qual.Positive; +import org.checkerframework.checker.pico.qual.Immutable; /** * A class for arithmetic on values of type {@code BigInteger}. @@ -53,6 +54,7 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@Immutable public final class BigIntegerMath { /** * Returns the smallest power of two greater than or equal to {@code x}. This is equivalent to diff --git a/guava/src/com/google/common/math/Quantiles.java b/guava/src/com/google/common/math/Quantiles.java index 01bdcc71db90..64c882a93a6b 100644 --- a/guava/src/com/google/common/math/Quantiles.java +++ b/guava/src/com/google/common/math/Quantiles.java @@ -135,6 +135,7 @@ @Beta @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Quantiles { /** Specifies the computation of a median (i.e. the 1st 2-quantile). */ diff --git a/guava/src/com/google/common/math/ToDoubleRounder.java b/guava/src/com/google/common/math/ToDoubleRounder.java index 2e7e7fae0944..126c11437a71 100644 --- a/guava/src/com/google/common/math/ToDoubleRounder.java +++ b/guava/src/com/google/common/math/ToDoubleRounder.java @@ -20,13 +20,17 @@ import com.google.common.annotations.GwtIncompatible; import java.math.RoundingMode; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.framework.qual.CFComment; + /** * Helper type to implement rounding {@code X} to a representable {@code double} value according to * a {@link RoundingMode}. */ @GwtIncompatible @ElementTypesAreNonnullByDefault -abstract class ToDoubleRounder> { +@CFComment("pico: explicit argument to avoid type annotation invalidate error") +abstract class ToDoubleRounder> { /** * Returns x rounded to either the greatest double less than or equal to the precise value of x, * or the least double greater than or equal to the precise value of x. diff --git a/guava/src/com/google/common/net/InetAddresses.java b/guava/src/com/google/common/net/InetAddresses.java index 8d7db9fe72ec..6903d1070049 100644 --- a/guava/src/com/google/common/net/InetAddresses.java +++ b/guava/src/com/google/common/net/InetAddresses.java @@ -98,6 +98,7 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class InetAddresses { private static final int IPV4_PART_COUNT = 4; private static final int IPV6_PART_COUNT = 8; diff --git a/guava/src/com/google/common/net/InternetDomainName.java b/guava/src/com/google/common/net/InternetDomainName.java index fc68bbc62ec8..6fb685224919 100644 --- a/guava/src/com/google/common/net/InternetDomainName.java +++ b/guava/src/com/google/common/net/InternetDomainName.java @@ -75,6 +75,7 @@ @GwtCompatible(emulated = true) @Immutable @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class InternetDomainName { private static final CharMatcher DOTS_MATCHER = CharMatcher.anyOf(".\u3002\uFF0E\uFF61"); diff --git a/guava/src/com/google/common/net/MediaType.java b/guava/src/com/google/common/net/MediaType.java index b66e7773c237..286f01356dca 100644 --- a/guava/src/com/google/common/net/MediaType.java +++ b/guava/src/com/google/common/net/MediaType.java @@ -74,6 +74,7 @@ @GwtCompatible @Immutable @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class MediaType { private static final String CHARSET_ATTRIBUTE = "charset"; private static final ImmutableListMultimap UTF_8_CONSTANT_PARAMETERS = diff --git a/guava/src/com/google/common/primitives/Booleans.java b/guava/src/com/google/common/primitives/Booleans.java index 3ea13c9103aa..57935961fa23 100644 --- a/guava/src/com/google/common/primitives/Booleans.java +++ b/guava/src/com/google/common/primitives/Booleans.java @@ -59,6 +59,7 @@ @AnnotatedFor({"signedness"}) @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Booleans { private Booleans() {} diff --git a/guava/src/com/google/common/primitives/Bytes.java b/guava/src/com/google/common/primitives/Bytes.java index 4079eae3c3a1..e4fd16cd4a27 100644 --- a/guava/src/com/google/common/primitives/Bytes.java +++ b/guava/src/com/google/common/primitives/Bytes.java @@ -63,6 +63,7 @@ @AnnotatedFor({"signedness"}) @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Bytes { private Bytes() {} diff --git a/guava/src/com/google/common/primitives/Chars.java b/guava/src/com/google/common/primitives/Chars.java index d7154f447bd2..aa1c71819ffd 100644 --- a/guava/src/com/google/common/primitives/Chars.java +++ b/guava/src/com/google/common/primitives/Chars.java @@ -67,6 +67,7 @@ @AnnotatedFor({"signedness"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Chars { private Chars() {} diff --git a/guava/src/com/google/common/primitives/Doubles.java b/guava/src/com/google/common/primitives/Doubles.java index a9af81b38025..a09d78b405ec 100644 --- a/guava/src/com/google/common/primitives/Doubles.java +++ b/guava/src/com/google/common/primitives/Doubles.java @@ -66,6 +66,7 @@ @AnnotatedFor({"signedness"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Doubles extends DoublesMethodsForWeb { private Doubles() {} diff --git a/guava/src/com/google/common/primitives/Floats.java b/guava/src/com/google/common/primitives/Floats.java index 146fd575ae67..6c1c1f327631 100644 --- a/guava/src/com/google/common/primitives/Floats.java +++ b/guava/src/com/google/common/primitives/Floats.java @@ -64,6 +64,7 @@ @AnnotatedFor({"signedness"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Floats extends FloatsMethodsForWeb { private Floats() {} diff --git a/guava/src/com/google/common/primitives/Ints.java b/guava/src/com/google/common/primitives/Ints.java index bd4a49b7c8a8..30ca6b296096 100644 --- a/guava/src/com/google/common/primitives/Ints.java +++ b/guava/src/com/google/common/primitives/Ints.java @@ -66,6 +66,7 @@ @AnnotatedFor({"signedness"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Ints extends IntsMethodsForWeb { private Ints() {} diff --git a/guava/src/com/google/common/primitives/Longs.java b/guava/src/com/google/common/primitives/Longs.java index 2bfc3f7bb570..7a235dca34ef 100644 --- a/guava/src/com/google/common/primitives/Longs.java +++ b/guava/src/com/google/common/primitives/Longs.java @@ -44,6 +44,11 @@ import org.checkerframework.checker.index.qual.Positive; import org.checkerframework.checker.index.qual.SubstringIndexFor; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Mutable; +import org.checkerframework.checker.pico.qual.ReceiverDependentMutable; +import org.checkerframework.checker.pico.qual.PolyMutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.Signed; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.common.value.qual.IntRange; @@ -64,6 +69,7 @@ @AnnotatedFor({"signedness"}) @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Longs { private Longs() {} @@ -122,7 +128,7 @@ public static int compare(long a, long b) { * @param target a primitive {@code long} value * @return {@code true} if {@code array[i] == target} for some value of {@code i} */ - public static boolean contains(long[] array, long target) { + public static boolean contains(long @Readonly [] array, long target) { for (long value : array) { if (value == target) { return true; @@ -139,12 +145,12 @@ public static boolean contains(long[] array, long target) { * @return the least index {@code i} for which {@code array[i] == target}, or {@code -1} if no * such index exists. */ - public static @IndexOrLow("#1") int indexOf(long[] array, long target) { + public static @IndexOrLow("#1") int indexOf(long @Readonly [] array, long target) { return indexOf(array, target, 0, array.length); } // TODO(kevinb): consider making this public - private static @IndexOrLow("#1") @LessThan("#4") int indexOf(long[] array, long target, @IndexOrHigh("#1") int start, @IndexOrHigh("#1") int end) { + private static @IndexOrLow("#1") @LessThan("#4") int indexOf(long @Readonly [] array, long target, @IndexOrHigh("#1") int start, @IndexOrHigh("#1") int end) { for (int i = start; i < end; i++) { if (array[i] == target) { return i; @@ -163,7 +169,7 @@ public static boolean contains(long[] array, long target) { * @param array the array to search for the sequence {@code target} * @param target the array to search for as a sub-sequence of {@code array} */ - public static @LTEqLengthOf("#1") @SubstringIndexFor(value = "#1", offset="#2.length - 1") int indexOf(long[] array, long[] target) { + public static @LTEqLengthOf("#1") @SubstringIndexFor(value = "#1", offset="#2.length - 1") int indexOf(long @Readonly [] array, long @Readonly [] target) { checkNotNull(array, "array"); checkNotNull(target, "target"); if (target.length == 0) { @@ -190,12 +196,12 @@ public static boolean contains(long[] array, long target) { * @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no * such index exists. */ - public static @IndexOrLow("#1") int lastIndexOf(long[] array, long target) { + public static @IndexOrLow("#1") int lastIndexOf(long @Readonly [] array, long target) { return lastIndexOf(array, target, 0, array.length); } // TODO(kevinb): consider making this public - private static @IndexOrLow("#1") @LessThan("#4") int lastIndexOf(long[] array, long target, @IndexOrHigh("#1") int start, @IndexOrHigh("#1") int end) { + private static @IndexOrLow("#1") @LessThan("#4") int lastIndexOf(long @Readonly [] array, long target, @IndexOrHigh("#1") int start, @IndexOrHigh("#1") int end) { for (int i = end - 1; i >= start; i--) { if (array[i] == target) { return i; @@ -212,7 +218,7 @@ public static boolean contains(long[] array, long target) { * the array * @throws IllegalArgumentException if {@code array} is empty */ - public static long min(long @MinLen(1)... array) { + public static long min(long @MinLen(1) @Readonly... array) { checkArgument(array.length > 0); long min = array[0]; for (int i = 1; i < array.length; i++) { @@ -231,7 +237,7 @@ public static long min(long @MinLen(1)... array) { * in the array * @throws IllegalArgumentException if {@code array} is empty */ - public static long max(long @MinLen(1)... array) { + public static long max(long @MinLen(1) @Readonly ... array) { checkArgument(array.length > 0); long max = array[0]; for (int i = 1; i < array.length; i++) { @@ -275,7 +281,7 @@ public static long constrainToRange(long value, long min, long max) { * range of length array.length in result. */ @SuppressWarnings("upperbound:argument") // sum of lengths - public static long[] concat(long[]... arrays) { + public static long[] concat(long @Readonly []... arrays) { int length = 0; for (long[] array : arrays) { length += array.length; @@ -321,7 +327,7 @@ public static byte[] toByteArray(long value) { * * @throws IllegalArgumentException if {@code bytes} has fewer than 8 elements */ - public static long fromByteArray(byte @MinLen(Longs.BYTES)[] bytes) { + public static long fromByteArray(byte @MinLen(Longs.BYTES) @Readonly [] bytes) { checkArgument(bytes.length >= BYTES, "array too small: %s < %s", bytes.length, BYTES); return fromBytes( bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7]); @@ -515,7 +521,7 @@ public static Converter stringConverter() { * @return an array containing the values of {@code array}, with guaranteed minimum length {@code * minLength} */ - public static long[] ensureCapacity(long[] array, @NonNegative int minLength, @NonNegative int padding) { + public static long[] ensureCapacity(long @Readonly [] array, @NonNegative int minLength, @NonNegative int padding) { checkArgument(minLength >= 0, "Invalid minLength: %s", minLength); checkArgument(padding >= 0, "Invalid padding: %s", padding); return (array.length < minLength) ? Arrays.copyOf(array, minLength + padding) : array; @@ -557,15 +563,15 @@ public static String join(String separator, long... array) { * * @since 2.0 */ - public static Comparator lexicographicalComparator() { + public static @Immutable Comparator lexicographicalComparator() { return LexicographicalComparator.INSTANCE; } - private enum LexicographicalComparator implements Comparator { + private enum LexicographicalComparator implements Comparator { INSTANCE; @Override - public int compare(long[] left, long[] right) { + public int compare(long @Readonly [] left, long @Readonly [] right) { int minLength = Math.min(left.length, right.length); for (int i = 0; i < minLength; i++) { int result = Longs.compare(left[i], right[i]); @@ -689,6 +695,7 @@ public static List asList(long... backingArray) { @CFComment({"signedness: A non-generic container class permits only signed values.", "Clients must suppress warnings when storing unsigned values."}) @GwtCompatible + @ReceiverDependentMutable private static class LongArrayAsList extends AbstractList implements RandomAccess, Serializable { @HasSubsequence(subsequence="this", from="this.start", to="this.end") @@ -696,7 +703,7 @@ private static class LongArrayAsList extends AbstractList final @IndexFor("array") @LessThan("this.end") int start; final @IndexOrHigh("array") int end; - LongArrayAsList(long @MinLen(1)[] array) { + LongArrayAsList(long @MinLen(1) @ReceiverDependentMutable [] array) { this(array, 0, array.length); } @@ -705,43 +712,43 @@ private static class LongArrayAsList extends AbstractList // leads to the first two issuing errors - since each field is dependent on // at least one of the others ) - LongArrayAsList(long @MinLen(1)[] array, @IndexFor("#1") @LessThan("#3") int start, @IndexOrHigh("#1") int end) { + LongArrayAsList(long @MinLen(1) @ReceiverDependentMutable [] array, @IndexFor("#1") @LessThan("#3") int start, @IndexOrHigh("#1") int end) { this.array = array; this.start = start; this.end = end; } @Override - public @Positive @LTLengthOf(value = {"this","array"}, offset={"-1","start - 1"}) int size() { // INDEX: Annotation on a public method refers to private member. + public @Positive @LTLengthOf(value = {"this","array"}, offset={"-1","start - 1"}) int size(@Readonly LongArrayAsList this) { // INDEX: Annotation on a public method refers to private member. return end - start; } @Override - public boolean isEmpty() { + public boolean isEmpty(@Readonly LongArrayAsList this) { return false; } @Override - public Long get(@IndexFor("this") int index) { + public Long get(@Readonly LongArrayAsList this, @IndexFor("this") int index) { checkElementIndex(index, size()); return array[start + index]; } @Override - public Spliterator.OfLong spliterator() { + public Spliterator.OfLong spliterator(@Readonly LongArrayAsList this) { return Spliterators.spliterator(array, start, end, 0); } @Override @SuppressWarnings("signedness:cast.unsafe") // non-generic container class - public boolean contains(@CheckForNull @UnknownSignedness Object target) { + public boolean contains(@Readonly LongArrayAsList this, @CheckForNull @UnknownSignedness @Readonly Object target) { // Overridden to prevent a ton of boxing return (target instanceof Long) && Longs.indexOf(array, (@Signed Long) target, start, end) != -1; } @Override @SuppressWarnings("signedness:cast.unsafe") // non-generic container class - public @IndexOrLow("this") int indexOf(@CheckForNull @UnknownSignedness Object target) { + public @IndexOrLow("this") int indexOf(@Readonly LongArrayAsList this, @CheckForNull @UnknownSignedness @Readonly Object target) { // Overridden to prevent a ton of boxing if (target instanceof Long) { int i = Longs.indexOf(array, (@Signed Long) target, start, end); @@ -754,7 +761,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object target) { @Override @SuppressWarnings("signedness:cast.unsafe") // non-generic container class - public @IndexOrLow("this") int lastIndexOf(@CheckForNull @UnknownSignedness Object target) { + public @IndexOrLow("this") int lastIndexOf(@Readonly LongArrayAsList this, @CheckForNull @UnknownSignedness @Readonly Object target) { // Overridden to prevent a ton of boxing if (target instanceof Long) { int i = Longs.lastIndexOf(array, (@Signed Long) target, start, end); @@ -766,7 +773,7 @@ public boolean contains(@CheckForNull @UnknownSignedness Object target) { } @Override - public Long set(@IndexFor("this") int index, Long element) { + public Long set(@Mutable LongArrayAsList this, @IndexFor("this") int index, Long element) { checkElementIndex(index, size()); long oldValue = array[start + index]; // checkNotNull for GWT (do not optimize) @@ -776,7 +783,7 @@ public Long set(@IndexFor("this") int index, Long element) { @Override @SuppressWarnings("index") // needs https://github.com/kelloggm/checker-framework/issues/229 - public List subList(@IndexOrHigh("this") int fromIndex, @IndexOrHigh("this") int toIndex) { + public @PolyMutable List subList(@PolyMutable LongArrayAsList this, @IndexOrHigh("this") int fromIndex, @IndexOrHigh("this") int toIndex) { int size = size(); checkPositionIndexes(fromIndex, toIndex, size); if (fromIndex == toIndex) { @@ -786,7 +793,7 @@ public List subList(@IndexOrHigh("this") int fromIndex, @IndexOrHigh("this } @Override - public boolean equals(@CheckForNull @UnknownSignedness Object object) { + public boolean equals(@Readonly LongArrayAsList this, @CheckForNull @UnknownSignedness @Readonly Object object) { if (object == this) { return true; } @@ -807,7 +814,7 @@ public boolean equals(@CheckForNull @UnknownSignedness Object object) { } @Override - public int hashCode(@UnknownSignedness LongArrayAsList this) { + public int hashCode(@UnknownSignedness @Readonly LongArrayAsList this) { int result = 1; for (int i = start; i < end; i++) { result = 31 * result + Longs.hashCode(array[i]); @@ -816,7 +823,7 @@ public int hashCode(@UnknownSignedness LongArrayAsList this) { } @Override - public String toString() { + public String toString(@Readonly LongArrayAsList this) { StringBuilder builder = new StringBuilder(size() * 10); builder.append('[').append(array[start]); for (int i = start + 1; i < end; i++) { diff --git a/guava/src/com/google/common/primitives/Shorts.java b/guava/src/com/google/common/primitives/Shorts.java index 9370fcebeec6..4c375ca5463c 100644 --- a/guava/src/com/google/common/primitives/Shorts.java +++ b/guava/src/com/google/common/primitives/Shorts.java @@ -63,6 +63,7 @@ @AnnotatedFor({"signedness"}) @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Shorts extends ShortsMethodsForWeb { private Shorts() {} diff --git a/guava/src/com/google/common/primitives/SignedBytes.java b/guava/src/com/google/common/primitives/SignedBytes.java index d24217444e24..451ab48502ec 100644 --- a/guava/src/com/google/common/primitives/SignedBytes.java +++ b/guava/src/com/google/common/primitives/SignedBytes.java @@ -40,6 +40,7 @@ // javadoc? @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class SignedBytes { private SignedBytes() {} diff --git a/guava/src/com/google/common/primitives/UnsignedBytes.java b/guava/src/com/google/common/primitives/UnsignedBytes.java index 0db9995e4856..e630b9ac6dd8 100644 --- a/guava/src/com/google/common/primitives/UnsignedBytes.java +++ b/guava/src/com/google/common/primitives/UnsignedBytes.java @@ -56,6 +56,7 @@ @AnnotatedFor({"signedness"}) @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class UnsignedBytes { private UnsignedBytes() {} diff --git a/guava/src/com/google/common/primitives/UnsignedLong.java b/guava/src/com/google/common/primitives/UnsignedLong.java index edcc662c564d..ba7f7ffb161d 100644 --- a/guava/src/com/google/common/primitives/UnsignedLong.java +++ b/guava/src/com/google/common/primitives/UnsignedLong.java @@ -48,6 +48,7 @@ @AnnotatedFor({"signedness"}) @GwtCompatible(serializable = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class UnsignedLong extends Number implements Comparable, Serializable { private static final long UNSIGNED_MASK = 0x7fffffffffffffffL; diff --git a/guava/src/com/google/common/primitives/UnsignedLongs.java b/guava/src/com/google/common/primitives/UnsignedLongs.java index 296567390189..0dfd77c4a6c6 100644 --- a/guava/src/com/google/common/primitives/UnsignedLongs.java +++ b/guava/src/com/google/common/primitives/UnsignedLongs.java @@ -59,6 +59,7 @@ @Beta @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class UnsignedLongs { private UnsignedLongs() {} diff --git a/guava/src/com/google/common/reflect/AbstractInvocationHandler.java b/guava/src/com/google/common/reflect/AbstractInvocationHandler.java index c79aa90970ff..02cf781deebc 100644 --- a/guava/src/com/google/common/reflect/AbstractInvocationHandler.java +++ b/guava/src/com/google/common/reflect/AbstractInvocationHandler.java @@ -20,6 +20,7 @@ import java.util.Arrays; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -40,6 +41,7 @@ * @since 12.0 */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class AbstractInvocationHandler implements InvocationHandler { private static final Object[] NO_ARGS = {}; @@ -61,7 +63,7 @@ public abstract class AbstractInvocationHandler implements InvocationHandler { */ @Override @CheckForNull - public final Object invoke(Object proxy, Method method, @CheckForNull @Nullable Object[] args) + public final @Readonly Object invoke(Object proxy, Method method, @CheckForNull @Nullable @Readonly Object[] args) throws Throwable { if (args == null) { args = NO_ARGS; diff --git a/guava/src/com/google/common/reflect/ClassPath.java b/guava/src/com/google/common/reflect/ClassPath.java index 20333d39fef9..0172f0232cf6 100644 --- a/guava/src/com/google/common/reflect/ClassPath.java +++ b/guava/src/com/google/common/reflect/ClassPath.java @@ -92,6 +92,7 @@ * @since 14.0 */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class ClassPath { private static final Logger logger = Logger.getLogger(ClassPath.class.getName()); diff --git a/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java b/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java index 6273704a1072..9eac8971d1e7 100644 --- a/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java +++ b/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java @@ -29,6 +29,7 @@ * @since 13.0 */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class ImmutableTypeToInstanceMap extends ForwardingMap, B> implements TypeToInstanceMap { diff --git a/guava/src/com/google/common/reflect/Invokable.java b/guava/src/com/google/common/reflect/Invokable.java index f0df59fb2255..7516bef61edd 100644 --- a/guava/src/com/google/common/reflect/Invokable.java +++ b/guava/src/com/google/common/reflect/Invokable.java @@ -66,6 +66,7 @@ */ @Beta @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public abstract class Invokable implements AnnotatedElement, Member { private final AccessibleObject accessibleObject; private final Member member; diff --git a/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java b/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java index 49fc55419f8d..50516a87527d 100644 --- a/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java +++ b/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java @@ -30,8 +30,11 @@ import org.checkerframework.checker.nullness.qual.KeyFor; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.checkerframework.checker.pico.qual.Immutable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.PolySigned; import org.checkerframework.checker.signedness.qual.UnknownSignedness; +import org.checkerframework.framework.qual.AnnotatedFor; /** * A mutable type-to-instance map. See also {@link ImmutableTypeToInstanceMap}. @@ -43,6 +46,7 @@ * @since 13.0 */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class MutableTypeToInstanceMap extends ForwardingMap, B> implements TypeToInstanceMap { @@ -124,11 +128,12 @@ private T trustedGet(TypeToken type) { return (T) backingMap.get(type); } - private static final class UnmodifiableEntry extends ForwardingMapEntry { + @Immutable + private static final class UnmodifiableEntry extends ForwardingMapEntry { private final Entry delegate; - static Set> transformEntries(Set> entries) { + static Set> transformEntries(Set> entries) { return new ForwardingSet>() { @Override protected Set> delegate() { @@ -155,13 +160,13 @@ public Iterator> iterator() { @Override @SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations - public T[] toArray(T[] array) { + public T[] toArray(T[] array) { return standardToArray(array); } }; } - private static Iterator> transformEntries(Iterator> entries) { + private static Iterator> transformEntries(Iterator> entries) { return Iterators.transform(entries, UnmodifiableEntry::new); } diff --git a/guava/src/com/google/common/reflect/Parameter.java b/guava/src/com/google/common/reflect/Parameter.java index 6b796f0d36fe..10dd0bc076fb 100644 --- a/guava/src/com/google/common/reflect/Parameter.java +++ b/guava/src/com/google/common/reflect/Parameter.java @@ -38,6 +38,7 @@ */ @Beta @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Parameter implements AnnotatedElement { private final Invokable declaration; diff --git a/guava/src/com/google/common/reflect/TypeResolver.java b/guava/src/com/google/common/reflect/TypeResolver.java index 063e7fd6f44c..f8a66a6b87b3 100644 --- a/guava/src/com/google/common/reflect/TypeResolver.java +++ b/guava/src/com/google/common/reflect/TypeResolver.java @@ -52,6 +52,7 @@ * @since 15.0 */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class TypeResolver { private final TypeTable typeTable; diff --git a/guava/src/com/google/common/reflect/TypeToken.java b/guava/src/com/google/common/reflect/TypeToken.java index 0f93c7972798..a02b9725b18a 100644 --- a/guava/src/com/google/common/reflect/TypeToken.java +++ b/guava/src/com/google/common/reflect/TypeToken.java @@ -98,7 +98,7 @@ * @author Ben Yu * @since 12.0 */ -@SuppressWarnings("serial") // SimpleTypeToken is the serialized form. +@SuppressWarnings({"serial", "pico"}) // SimpleTypeToken is the serialized form. @ElementTypesAreNonnullByDefault public abstract class TypeToken extends TypeCapture implements Serializable { diff --git a/guava/src/com/google/common/reflect/Types.java b/guava/src/com/google/common/reflect/Types.java index 3f271994ef49..1b701fc2bedc 100644 --- a/guava/src/com/google/common/reflect/Types.java +++ b/guava/src/com/google/common/reflect/Types.java @@ -46,6 +46,7 @@ import java.util.concurrent.atomic.AtomicReference; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; import org.checkerframework.common.value.qual.MinLen; @@ -55,6 +56,7 @@ * @author Ben Yu */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class Types { /** Class#toString without the "class " and "interface " prefixes */ @@ -520,7 +522,7 @@ public String toString() { private static final long serialVersionUID = 0; } - private static Type[] toArray(Collection types) { + private static Type[] toArray(@Readonly Collection types) { return types.toArray(new Type[0]); } diff --git a/guava/src/com/google/common/util/concurrent/AbstractFuture.java b/guava/src/com/google/common/util/concurrent/AbstractFuture.java index fc408a92d24a..7a8ddd8b1b04 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractFuture.java +++ b/guava/src/com/google/common/util/concurrent/AbstractFuture.java @@ -70,6 +70,7 @@ @SuppressWarnings({ "ShortCircuitBoolean", // we use non-short circuiting comparisons intentionally "nullness", // TODO(b/147136275): Remove once our checker understands & and |. + "pico" }) @GwtCompatible(emulated = true) @ReflectionSupport(value = ReflectionSupport.Level.FULL) @@ -666,7 +667,7 @@ mayInterruptIfRunning, new CancellationException("Future.cancel() was called.")) if (localValue instanceof SetFuture) { // propagate cancellation to the future set in setfuture, this is racy, and we don't // care if we are successful or not. - ListenableFuture futureToPropagateTo = ((SetFuture) localValue).future; + ListenableFuture futureToPropagateTo = ((SetFuture) localValue).future; if (futureToPropagateTo instanceof Trusted) { // If the future is a TrustedFuture then we specifically avoid calling cancel() // this has 2 benefits diff --git a/guava/src/com/google/common/util/concurrent/AtomicLongMap.java b/guava/src/com/google/common/util/concurrent/AtomicLongMap.java index 3774e744fca8..bb82b9331538 100644 --- a/guava/src/com/google/common/util/concurrent/AtomicLongMap.java +++ b/guava/src/com/google/common/util/concurrent/AtomicLongMap.java @@ -30,6 +30,7 @@ import java.util.function.LongBinaryOperator; import java.util.function.LongUnaryOperator; import javax.annotation.CheckForNull; +import org.checkerframework.checker.pico.qual.Readonly; import org.checkerframework.checker.signedness.qual.UnknownSignedness; /** @@ -57,6 +58,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class AtomicLongMap implements Serializable { private final ConcurrentHashMap map; @@ -277,7 +279,7 @@ private Map createAsMap() { } /** Returns true if this map contains a mapping for the specified key. */ - public boolean containsKey(@UnknownSignedness Object key) { + public boolean containsKey(@UnknownSignedness @Readonly Object key) { return map.containsKey(key); } diff --git a/guava/src/com/google/common/util/concurrent/ClosingFuture.java b/guava/src/com/google/common/util/concurrent/ClosingFuture.java index fbd604ceadfe..d13444c30214 100644 --- a/guava/src/com/google/common/util/concurrent/ClosingFuture.java +++ b/guava/src/com/google/common/util/concurrent/ClosingFuture.java @@ -192,6 +192,7 @@ @DoNotMock("Use ClosingFuture.from(Futures.immediate*Future)") @ElementTypesAreNonnullByDefault // TODO(dpb): GWT compatibility. +@SuppressWarnings("pico") public final class ClosingFuture { private static final Logger logger = Logger.getLogger(ClosingFuture.class.getName()); diff --git a/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java b/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java index decb5f1b183d..2b8a00426c13 100644 --- a/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java +++ b/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java @@ -164,6 +164,7 @@ @CanIgnoreReturnValue // TODO(cpovirk): Consider being more strict. @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public class CycleDetectingLockFactory { /** diff --git a/guava/src/com/google/common/util/concurrent/DirectExecutor.java b/guava/src/com/google/common/util/concurrent/DirectExecutor.java index 0c3a46b703c3..35389b132959 100644 --- a/guava/src/com/google/common/util/concurrent/DirectExecutor.java +++ b/guava/src/com/google/common/util/concurrent/DirectExecutor.java @@ -23,6 +23,7 @@ */ @GwtCompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") enum DirectExecutor implements Executor { INSTANCE; diff --git a/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java b/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java index 80c7779342b1..9159e590aaf7 100644 --- a/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java +++ b/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java @@ -84,6 +84,7 @@ * @since 26.0 */ @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class ExecutionSequencer { private ExecutionSequencer() {} diff --git a/guava/src/com/google/common/util/concurrent/Futures.java b/guava/src/com/google/common/util/concurrent/Futures.java index 09b5c3c1a426..e3056a26453d 100644 --- a/guava/src/com/google/common/util/concurrent/Futures.java +++ b/guava/src/com/google/common/util/concurrent/Futures.java @@ -76,6 +76,7 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class Futures extends GwtFuturesCatchingSpecialization { // A note on memory visibility. diff --git a/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java b/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java index 6f09b8066d55..8d63fb9f8276 100644 --- a/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java +++ b/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java @@ -41,6 +41,7 @@ /** Static methods used to implement {@link Futures#getChecked(Future, Class)}. */ @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") final class FuturesGetChecked { @CanIgnoreReturnValue @ParametricNullness diff --git a/guava/src/com/google/common/util/concurrent/MoreExecutors.java b/guava/src/com/google/common/util/concurrent/MoreExecutors.java index f7f356c29183..7636759a9075 100644 --- a/guava/src/com/google/common/util/concurrent/MoreExecutors.java +++ b/guava/src/com/google/common/util/concurrent/MoreExecutors.java @@ -65,6 +65,7 @@ */ @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class MoreExecutors { private MoreExecutors() {} diff --git a/guava/src/com/google/common/util/concurrent/ServiceManager.java b/guava/src/com/google/common/util/concurrent/ServiceManager.java index 5ab95ffa6b74..8c426114b7a5 100644 --- a/guava/src/com/google/common/util/concurrent/ServiceManager.java +++ b/guava/src/com/google/common/util/concurrent/ServiceManager.java @@ -122,6 +122,7 @@ */ @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class ServiceManager implements ServiceManagerBridge { private static final Logger logger = Logger.getLogger(ServiceManager.class.getName()); private static final ListenerCallQueue.Event HEALTHY_EVENT = diff --git a/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java b/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java index c6ade6a3a0a5..845a8083ddf9 100644 --- a/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java +++ b/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java @@ -36,6 +36,7 @@ import java.util.concurrent.TimeoutException; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; /** * A TimeLimiter that runs method calls in the background using an {@link ExecutorService}. If the @@ -48,6 +49,7 @@ @Beta @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class SimpleTimeLimiter implements TimeLimiter { private final ExecutorService executor; @@ -111,7 +113,7 @@ private static T newProxy(Class interfaceType, InvocationHandler handler) return interfaceType.cast(object); } - private T callWithTimeout( + private T callWithTimeout( Callable callable, long timeoutDuration, TimeUnit timeoutUnit, boolean amInterruptible) throws Exception { checkNotNull(callable); diff --git a/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java b/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java index de7236369d25..ae4e47b447b3 100644 --- a/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java +++ b/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java @@ -51,6 +51,7 @@ @CanIgnoreReturnValue @GwtIncompatible @ElementTypesAreNonnullByDefault +@SuppressWarnings("pico") public final class ThreadFactoryBuilder { @CheckForNull private @Format({ConversionCategory.INT}) String nameFormat = null; @CheckForNull private Boolean daemon = null; diff --git a/guava/src/com/google/common/util/concurrent/Uninterruptibles.java b/guava/src/com/google/common/util/concurrent/Uninterruptibles.java index 09ace92fae75..1964842a6e0f 100644 --- a/guava/src/com/google/common/util/concurrent/Uninterruptibles.java +++ b/guava/src/com/google/common/util/concurrent/Uninterruptibles.java @@ -35,6 +35,7 @@ import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.pico.qual.Readonly; /** * Utilities for treating interruptible operations as uninterruptible. In all cases, if a thread is @@ -298,7 +299,7 @@ public static void joinUninterruptibly(Thread toJoin, long timeout, TimeUnit uni @GwtIncompatible // TODO @SuppressWarnings("GoodTime") // should accept a java.time.Duration @ParametricNullness - public static V getUninterruptibly( + public static V getUninterruptibly( Future future, long timeout, TimeUnit unit) throws ExecutionException, TimeoutException { boolean interrupted = false; try { diff --git a/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java b/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java index c987065e4647..b2d3f7326fcb 100644 --- a/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java +++ b/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java @@ -36,6 +36,7 @@ */ @GwtCompatible @Beta +@SuppressWarnings("pico") public final class PublicSuffixPatterns { private PublicSuffixPatterns() {} diff --git a/temp.log b/temp.log new file mode 100644 index 000000000000..01a80cbcc2cf --- /dev/null +++ b/temp.log @@ -0,0 +1,7591 @@ +[INFO] Scanning for projects... +[WARNING] +[WARNING] Some problems were encountered while building the effective model for com.google.guava:guava:bundle:31.1-jre +[WARNING] 'profiles.profile[checkerframework-local].dependencies.dependency.systemPath' for io.github.eisop:checker-qual:jar should use a variable instead of a hard-coded path /Users/aosenxiong/waterloo/eisop/checker-framework/checker/dist/checker-qual.jar @ line 388, column 23 +[WARNING] 'profiles.profile[checkerframework-local].dependencies.dependency.systemPath' for io.github.eisop:checker:jar should use a variable instead of a hard-coded path /Users/aosenxiong/waterloo/eisop/checker-framework/checker/dist/checker.jar @ line 395, column 23 +[WARNING] +[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. +[WARNING] +[WARNING] For this reason, future Maven versions might no longer support building such malformed projects. +[WARNING] +[INFO] +[INFO] -----------------------< com.google.guava:guava >----------------------- +[INFO] Building Guava: Google Core Libraries for Java 31.1-jre +[INFO] from pom.xml +[INFO] -------------------------------[ bundle ]------------------------------- +[WARNING] Ignoring incompatible plugin version 4.0.0-beta-1: The plugin org.apache.maven.plugins:maven-resources-plugin:4.0.0-beta-1 requires Maven version 4.0.0-beta-3 +[INFO] Latest version of plugin org.apache.maven.plugins:maven-resources-plugin failed compatibility check +[INFO] Looking for compatible RELEASE version of plugin org.apache.maven.plugins:maven-resources-plugin +[INFO] Selected plugin org.apache.maven.plugins:maven-resources-plugin:3.3.1 +[WARNING] Ignoring incompatible plugin version 4.0.0-beta-2: The plugin org.apache.maven.plugins:maven-install-plugin:4.0.0-beta-2 requires Maven version 4.0.0-rc-2 +[INFO] Latest version of plugin org.apache.maven.plugins:maven-install-plugin failed compatibility check +[INFO] Looking for compatible RELEASE version of plugin org.apache.maven.plugins:maven-install-plugin +[WARNING] Ignoring incompatible plugin version 4.0.0-beta-1: The plugin org.apache.maven.plugins:maven-install-plugin:4.0.0-beta-1 requires Maven version 4.0.0-beta-3 +[INFO] Selected plugin org.apache.maven.plugins:maven-install-plugin:3.1.4 +[WARNING] Ignoring incompatible plugin version 4.0.0-beta-2: The plugin org.apache.maven.plugins:maven-deploy-plugin:4.0.0-beta-2 requires Maven version 4.0.0-rc-2 +[INFO] Latest version of plugin org.apache.maven.plugins:maven-deploy-plugin failed compatibility check +[INFO] Looking for compatible RELEASE version of plugin org.apache.maven.plugins:maven-deploy-plugin +[WARNING] Ignoring incompatible plugin version 4.0.0-beta-1: The plugin org.apache.maven.plugins:maven-deploy-plugin:4.0.0-beta-1 requires Maven version 4.0.0-beta-3 +[INFO] Selected plugin org.apache.maven.plugins:maven-deploy-plugin:3.1.4 +[INFO] +[INFO] --- clean:3.2.0:clean (default-clean) @ guava --- +[INFO] Deleting /Users/aosenxiong/waterloo/eisop/guava/guava/target +[INFO] +[INFO] --- enforcer:3.0.0-M3:enforce (enforce-versions) @ guava --- +[INFO] +[INFO] --- dependency:3.1.1:properties (default) @ guava --- +[INFO] +[INFO] --- dependency:3.1.1:unpack-dependencies (unpack-jdk-sources) @ guava --- +[INFO] Unpacking /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/lib/src.zip to /Users/aosenxiong/waterloo/eisop/guava/guava/target/jdk-sources with includes "" and excludes "**/module-info.java,**/java/io/FileDescriptor.java" +[INFO] +[INFO] --- compiler:3.8.1:compile (value-check) @ guava --- +[WARNING] Parameter 'compilerArguments' is deprecated: use {@link #compilerArgs} instead. +[INFO] Changes detected - recompiling the module! +[INFO] Compiling 619 source files to /Users/aosenxiong/waterloo/eisop/guava/guava/target/classes +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AbstractFuture.java:[33,20] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/reflect/Types.java:[42,20] [removal] AccessControlException in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AbstractFuture.java:[33,20] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/reflect/Types.java:[42,20] [removal] AccessControlException in java.security has been deprecated and marked for removal +[WARNING] The following options were not recognized by any processor: '[assumeInitialized]' +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AbstractFuture.java:[33,20] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/reflect/Types.java:[42,20] [removal] AccessControlException in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/hash/BloomFilter.java:[523,40] [[value, allcheckers]:cast.unsafe] cast from "@IntRangeFromPositive long" to "@IntRange(from=1, to=2147483647) double" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AbstractFuture.java:[1330,14] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/hash/Striped64.java:[303,26] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/primitives/UnsignedBytes.java:[359,30] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/cache/Striped64.java:[297,26] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/hash/LittleEndianByteArray.java:[181,28] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/reflect/Types.java:[372,19] [removal] AccessControlException in java.security has been deprecated and marked for removal +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ guava --- +[INFO] Copying 0 resource from src to target/classes +[INFO] +[INFO] --- compiler:3.8.1:compile (default-compile) @ guava --- +[WARNING] Parameter 'compilerArguments' is deprecated: use {@link #compilerArgs} instead. +[INFO] Nothing to compile - all classes are up to date +[INFO] +[INFO] --- compiler:3.8.1:compile (main-compile) @ guava --- +[WARNING] Parameter 'compilerArguments' is deprecated: use {@link #compilerArgs} instead. +[INFO] Changes detected - recompiling the module! +[INFO] Compiling 619 source files to /Users/aosenxiong/waterloo/eisop/guava/guava/target/classes +[INFO] ------------------------------------------------------------- +[WARNING] COMPILATION WARNING : +[INFO] ------------------------------------------------------------- +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AbstractFuture.java:[33,20] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/reflect/Types.java:[42,20] [removal] AccessControlException in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AbstractFuture.java:[33,20] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/reflect/Types.java:[42,20] [removal] AccessControlException in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AbstractFuture.java:[33,20] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/reflect/Types.java:[42,20] [removal] AccessControlException in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[345,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularImmutableMap.fromEntries. + found : @Mutable Entry @Mutable [] + required: @Immutable Entry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[557,19] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableMap.of + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object <: use of V from of(onlyEntry.getKey(), onlyEntry.getValue()) + From complementary bound.: V extends @Readonly Object -> use of V from of(onlyEntry.getKey(), onlyEntry.getValue()) + onlyEntry.getValue() -> use of V from of(onlyEntry.getKey(), onlyEntry.getValue()) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[569,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable Entry @Mutable [] + required: @Mutable Entry @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[574,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable Entry @Mutable [] + required: @Mutable Entry @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[650,19] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableMap.of + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object <: use of V from of(onlyEntry.getKey(), onlyEntry.getValue()) + From complementary bound.: V extends @Readonly Object -> use of V from of(onlyEntry.getKey(), onlyEntry.getValue()) + onlyEntry.getValue() -> use of V from of(onlyEntry.getKey(), onlyEntry.getValue()) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[703,17] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableMap.copyOf + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + capture#03 extends V extends @Readonly Object <: use of V from copyOf(map.entrySet()) + From complementary bound.: capture#03 extends V extends @Readonly Object <= inference type: ? extends V + @Mutable Entry <: inference type: java.util.Map.Entry + @Mutable Entry <= inference type: ? extends java.util.Map.Entry + @Mutable Set<@Mutable Entry> <: inference type: java.lang.Iterable> + @Mutable Set<@Mutable Entry> -> inference type: java.lang.Iterable> + map.entrySet() -> inference type: java.lang.Iterable> + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[731,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularImmutableMap.fromEntries. + found : @Mutable Entry @Mutable [] + required: @Immutable Entry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[741,39] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableEnumMap.asImmutable + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object = use of V from ImmutableEnumMap.asImmutable(copy) + From complementary bound.: V extends @Readonly Object <= use of V from ImmutableEnumMap.asImmutable(copy) + @Mutable EnumMap>, V extends @Readonly Object> <: inference type: java.util.EnumMap + @Mutable EnumMap>, V extends @Readonly Object> -> inference type: java.util.EnumMap + copy -> inference type: java.util.EnumMap + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[752,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter iterator of Spliterators.spliterator. + found : @Immutable UnmodifiableIterator<@Mutable Entry> + required: @Mutable Iterator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1069,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable ImmutableMap.@Readonly (@Immutable ImmutableMap this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1069,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1077,33] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable UnmodifiableIterator<@Mutable Entry> + required: @Mutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1119,51] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable ImmutableSetMultimap + required: @Readonly ImmutableSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1121,8] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSetMultimap + method return type: @Immutable ImmutableSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1121,24] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ImmutableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1122,12] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableSetMultimap constructor + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + use of V from new ImmutableSetMultimap<>(new MapViewOfValuesAsSingletonSets(), size(), null) = V extends @Readonly Object + From complementary bound.: @Immutable ImmutableSet = inference type: com.google.common.collect.ImmutableSet + @Immutable ImmutableSet <= inference type: com.google.common.collect.ImmutableSet + @Immutable ImmutableMap.@Immutable MapViewOfValuesAsSingletonSets <: inference type: com.google.common.collect.ImmutableMap> + @Immutable ImmutableMap.@Immutable MapViewOfValuesAsSingletonSets -> inference type: com.google.common.collect.ImmutableMap> + new MapViewOfValuesAsSingletonSets() -> inference type: com.google.common.collect.ImmutableMap> + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1172,13] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable ImmutableMap.@Immutable MapViewOfValuesAsSingletonSets.@Readonly (@Immutable ImmutableMap.@Immutable MapViewOfValuesAsSingletonSets this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1172,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator<@Mutable Entry>> + method return type: @Immutable UnmodifiableIterator<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1180,63] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable Iterator<@Mutable Entry> + required: @Mutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1243,85] [[immutability, pico, piconoinit, allcheckers]:enhancedfor.type.incompatible] incompatible types in enhanced for loop. + found : @Mutable Entry + required: @Readonly Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1245,36] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : capture#05 extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1252,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable ImmutableSet + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1253,30] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable ImmutableCollection + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1271,32] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMap.java:[1271,50] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapEntrySet.java:[48,58] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularEntrySet constructor. + found : @Immutable ImmutableList<@Mutable Entry> + required: @Immutable ImmutableList<@Immutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapEntrySet.java:[69,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@Immutable Entry> + method return type: @Immutable UnmodifiableIterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapEntrySet.java:[74,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator<@Immutable Entry> + method return type: @Mutable Spliterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapEntrySet.java:[79,22] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter consumer of ImmutableList.forEach. + found : @Mutable Consumer> + required: @Mutable Consumer> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapEntrySet.java:[84,13] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for RegularImmutableAsList constructor + unsatisfiable constraint: @Immutable Entry <: @Mutable Entry + @Immutable Entry <: use of E from new RegularImmutableAsList<>(this, entries) + From complementary bound.: @Immutable Entry <= inference type: ? extends E + @Immutable ImmutableList<@Immutable Entry> <: inference type: com.google.common.collect.ImmutableList + @Immutable ImmutableList<@Immutable Entry> -> inference type: com.google.common.collect.ImmutableList + entries -> inference type: com.google.common.collect.ImmutableList + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapEntrySet.java:[100,26] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[248,37] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly Object @Mutable [] + required: @Mutable Object @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[314,54] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of ImmutableEnumSet.asImmutable. + found : @Mutable EnumSet + required: @Immutable EnumSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[314,54] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for EnumSet.copyOf + unsatisfiable constraint: @Mutable EnumSet -> @Immutable EnumSet + From: Constraint between method call type and target type for method call (unchecked conversion): EnumSet.copyOf(enumSet) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[401,13] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable Indexed.@Readonly (@Immutable Indexed this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[401,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly ImmutableList + method return type: @Immutable ImmutableList +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[430,19] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSet<@Mutable Object> + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[430,19] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableSet.copyOf + unsatisfiable constraint: inference type: com.google.common.collect.ImmutableSet <: @Mutable Object + inference type: com.google.common.collect.ImmutableSet -> @Mutable Object + From: Constraint between method call type and target type for method call:copyOf(elements) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[807,54] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of RegularSetBuilderImpl.rebuildHashTable. + found : E extends @Readonly Object @Mutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[811,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter hashTable of RegularSetBuilderImpl.hashFloodingDetected. + found : @Readonly Object @Mutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[836,14] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of RegularImmutableSet constructor. + found : @Readonly Object @Mutable [] + required: @Mutable Object @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[836,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter table of RegularImmutableSet constructor. + found : @Readonly Object @Mutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[836,48] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @Readonly Object @Mutable [] <: @Mutable Object @Mutable [] + use of T from requireNonNull(hashTable) <: @Mutable Object @Mutable [] + From complementary bound.: use of T from requireNonNull(hashTable) -> @Mutable Object @Mutable [] + From: Constraint between method call type and target type for method call:requireNonNull(hashTable) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[866,51] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of RegularSetBuilderImpl.rebuildHashTable. + found : E extends @Readonly Object @Mutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[958,48] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Sets.newHashSetWithExpectedSize + unsatisfiable constraint: @Readonly Object <: @Immutable Object + use of E from Sets.newHashSetWithExpectedSize(distinct) = @Readonly Object + From complementary bound.: use of E from Sets.newHashSetWithExpectedSize(distinct) <= @Readonly Object + inference type: java.util.HashSet <: @Mutable Set<@Readonly Object> + inference type: java.util.HashSet -> @Mutable Set<@Readonly Object> + From: Constraint between method call type and target type for method call:Sets.newHashSetWithExpectedSize(distinct) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSet.java:[995,14] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of JdkBackedImmutableSet constructor. + found : @Mutable Set<@Readonly Object> + required: @Immutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableCollection.java:[377,47] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableList.java:[316,39] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clone() not allowed on the given receiver. + found : E extends @Readonly Object @Readonly [] + required: @Mutable Array +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableList.java:[406,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of RegularImmutableList constructor. + found : @Readonly Object @Readonly [] + required: @Mutable Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableList.java:[735,19] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableList<@Mutable Object> + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableList.java:[735,19] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableList.copyOf + unsatisfiable constraint: inference type: com.google.common.collect.ImmutableList <: @Mutable Object + inference type: com.google.common.collect.ImmutableList -> @Mutable Object + From: Constraint between method call type and target type for method call:copyOf(elements) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableList.java:[852,10] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of Builder.add. + found : E extends @Readonly Object @Mutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableList.java:[911,17] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of Builder.add. + found : @Readonly Object @Mutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractIndexedListIterator.java:[45,36] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.extends.clause] Class with annotation @ReceiverDependentMutable cannot extend @Immutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractIndexedListIterator.java:[74,64] [[immutability, pico, piconoinit, allcheckers]:super.invocation.invalid] Constructor of type @ReceiverDependentMutable cannot call super() of type @Immutable. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapEntry.java:[65,25] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSetMultimap.java:[364,28] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter mapEntries of ImmutableSetMultimap.fromMapEntries. + found : @Readonly Collection<@Mutable Entry>> + required: @Mutable Collection>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSetMultimap.java:[561,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@Immutable Entry> + method return type: @Immutable UnmodifiableIterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSetMultimap.java:[598,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Serialization.writeMultimap. + found : @Immutable ImmutableSetMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSetMultimap.java:[642,18] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of Builder.put. + found : @Mutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[270,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter values of Builder.putAll. + found : @Readonly Collection + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[311,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter mapEntries of ImmutableListMultimap.fromMapEntries. + found : @Readonly Collection<@Mutable Entry>> + required: @Mutable Collection>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[592,28] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Immutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[603,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable ImmutableMultimap.@Readonly (@Immutable ImmutableMultimap this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[603,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator<@Immutable Entry> + method return type: @Immutable UnmodifiableIterator<@Immutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[605,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable UnmodifiableIterator<@Mutable Entry>> + required: @Mutable Iterator>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[607,52] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[619,46] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[694,79] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Entry> + required: @Readonly Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[740,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable ImmutableMultimap.@Readonly (@Immutable ImmutableMultimap this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[740,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[741,91] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable UnmodifiableIterator> + required: @Mutable Iterator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[742,52] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultimap.java:[752,55] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[236,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Supplier> + required: @ReceiverDependentMutable Supplier> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[236,33] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Supplier> <: @ReceiverDependentMutable Supplier> + use of T from checkNotNull(factory) <: @ReceiverDependentMutable Supplier> + From complementary bound.: use of T from checkNotNull(factory) -> @ReceiverDependentMutable Supplier> + From: Constraint between method call type and target type for method call:checkNotNull(factory) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[246,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map> + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[258,45] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable NavigableSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[260,49] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[262,43] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable Set" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[264,44] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[300,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CustomMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[300,16] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Supplier> + required: @ReceiverDependentMutable Supplier> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[302,12] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setMap(java.util.Map>) not allowed on the given receiver. + found : @ReceiverDependentMutable CustomMultimap + required: @Mutable AbstractMapBasedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[352,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Supplier> + required: @ReceiverDependentMutable Supplier> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[352,33] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Supplier> <: @ReceiverDependentMutable Supplier> + use of T from checkNotNull(factory) <: @ReceiverDependentMutable Supplier> + From complementary bound.: use of T from checkNotNull(factory) -> @ReceiverDependentMutable Supplier> + From: Constraint between method call type and target type for method call:checkNotNull(factory) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[362,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map> + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[367,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: capture#022 extends @PolyMutable List + method return type: @ReceiverDependentMutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[382,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CustomListMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[382,16] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Supplier> + required: @ReceiverDependentMutable Supplier> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[384,12] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setMap(java.util.Map>) not allowed on the given receiver. + found : @ReceiverDependentMutable CustomListMultimap + required: @Mutable AbstractMapBasedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[433,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Supplier> + required: @ReceiverDependentMutable Supplier> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[433,33] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Supplier> <: @ReceiverDependentMutable Supplier> + use of T from checkNotNull(factory) <: @ReceiverDependentMutable Supplier> + From complementary bound.: use of T from checkNotNull(factory) -> @ReceiverDependentMutable Supplier> + From: Constraint between method call type and target type for method call:checkNotNull(factory) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[443,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map> + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[466,57] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of WrappedNavigableSet constructor. + found : @Mutable NavigableSet + required: @PolyMutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[466,57] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Collection" to "@Mutable NavigableSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[468,54] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of WrappedSortedSet constructor. + found : @Mutable SortedSet + required: @PolyMutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[468,54] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Collection" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[470,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of WrappedSet constructor. + found : @Mutable Set + required: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[470,48] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Collection" to "@Mutable Set" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[486,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CustomSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[486,16] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Supplier> + required: @ReceiverDependentMutable Supplier> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[488,12] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setMap(java.util.Map>) not allowed on the given receiver. + found : @ReceiverDependentMutable CustomSetMultimap + required: @Mutable AbstractMapBasedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[539,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Supplier> + required: @ReceiverDependentMutable Supplier> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[539,33] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Supplier> <: @ReceiverDependentMutable Supplier> + use of T from checkNotNull(factory) <: @ReceiverDependentMutable Supplier> + From complementary bound.: use of T from checkNotNull(factory) -> @ReceiverDependentMutable Supplier> + From: Constraint between method call type and target type for method call:checkNotNull(factory) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[550,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map> + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[576,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CustomSortedSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[576,16] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Supplier> + required: @ReceiverDependentMutable Supplier> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[577,22] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CustomSortedSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[579,12] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setMap(java.util.Map>) not allowed on the given receiver. + found : @ReceiverDependentMutable CustomSortedSetMultimap + required: @Mutable AbstractMapBasedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[660,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableMultimap + method return type: @Readonly Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[671,23] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableMultimap + method return type: @Readonly Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[671,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Immutable ImmutableMultimap <: @Readonly Multimap + use of T from checkNotNull(delegate) <: @Readonly Multimap + From complementary bound.: use of T from checkNotNull(delegate) -> @Readonly Multimap + From: Constraint between method call type and target type for method call:checkNotNull(delegate) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[704,43] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Collections.unmodifiableMap + unsatisfiable constraint: @Readonly Collection <: @Mutable Collection + use of V1 from Maps.transformValues(delegate.asMap(), new Function, Collection>(){ + + () { + super(); + } + + @Override + public Collection apply(Collection collection) { + return unmodifiableValueCollection(collection); + } + }) <: @Mutable Collection + From complementary bound.: @Mutable Collection <= inference type: ? super V1 + @Immutable UnmodifiableMultimap.@Mutable <: inference type: com.google.common.base.Function + @Immutable UnmodifiableMultimap.@Mutable -> inference type: com.google.common.base.Function + new Function, Collection>(){ + + () { + super(); + } + + @Override + public Collection apply(Collection collection) { + return unmodifiableValueCollection(collection); + } + } -> inference type: com.google.common.base.Function + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[722,63] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of Multimaps.unmodifiableEntries. + found : @Readonly Collection<@Readonly Entry> + required: @Readonly Collection<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[729,22] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to forEach(java.util.function.BiConsumer) not allowed on the given receiver. + found : @Readonly Multimap + required: @PICOLost Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[741,68] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of Multisets.unmodifiableMultiset. + found : @Readonly Multiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[902,39] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to valueComparator() not allowed on the given receiver. + found : @Readonly SortedSetMultimap + required: @PICOLost SortedSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[951,23] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSetMultimap + method return type: @Readonly SetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[951,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Immutable ImmutableSetMultimap <: @Readonly SetMultimap + use of T from checkNotNull(delegate) <: @Readonly SetMultimap + From complementary bound.: use of T from checkNotNull(delegate) -> @Readonly SetMultimap + From: Constraint between method call type and target type for method call:checkNotNull(delegate) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1030,23] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableListMultimap + method return type: @Mutable ListMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1030,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Immutable ImmutableListMultimap <: @Mutable ListMultimap + use of T from checkNotNull(delegate) <: @Mutable ListMultimap + From complementary bound.: use of T from checkNotNull(delegate) -> @Mutable ListMultimap + From: Constraint between method call type and target type for method call:checkNotNull(delegate) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1044,47] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1046,41] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable Set" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1048,42] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1064,39] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection<@Mutable Entry>" to "@Mutable Set<@Readonly Entry>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1108,60] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Map>" to "@PolyMutable Map" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1140,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for MapMultimap constructor + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object = use of V from new MapMultimap<>(map) + From complementary bound.: V extends @Readonly Object <= use of V from new MapMultimap<>(map) + @Mutable Map <: inference type: @org.checkerframework.checker.pico.qual.ReceiverDependentMutable java.util.Map + @Mutable Map -> inference type: @org.checkerframework.checker.pico.qual.ReceiverDependentMutable java.util.Map + map -> inference type: @org.checkerframework.checker.pico.qual.ReceiverDependentMutable java.util.Map + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1175,25] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to entrySet() not allowed on the given receiver. + found : @PICOLost Map + required: @PICOLost Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1175,56] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Maps.immutableEntry + unsatisfiable constraint: @Readonly Object <: @Immutable Object + @Readonly Object <: use of K from Maps.immutableEntry(key, value) + From complementary bound.: @Readonly Object -> use of K from Maps.immutableEntry(key, value) + key -> use of K from Maps.immutableEntry(key, value) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1180,60] [[immutability, pico, piconoinit, allcheckers]:constructor.return.invalid] Invalid constructor return type: @Mutable MapMultimap.@PolyMutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1244,54] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Maps.immutableEntry + unsatisfiable constraint: @Readonly Object <: @Immutable Object + @Readonly Object <: use of K from Maps.immutableEntry(key, value) + From complementary bound.: @Readonly Object -> use of K from Maps.immutableEntry(key, value) + key -> use of K from Maps.immutableEntry(key, value) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1287,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Keys + method return type: @PolyMutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1287,38] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Keys constructor. + found : @PolyMutable MapMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1297,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AsMap + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1297,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of AsMap constructor. + found : @PolyMutable MapMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1536,70] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter transformer of Maps.asValueToValueFunction. + found : @ReceiverDependentMutable EntryTransformer + required: @Mutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1546,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Maps.transformEntries + unsatisfiable constraint: @PolyMutable Collection <: @Mutable Collection + use of V1 from Maps.transformEntries(fromMultimap.asMap(), new EntryTransformer, Collection>(){ + + () { + super(); + } + + @Override + @PolyMutable + public Collection transformEntry(@ParametricNullness + K key, @PolyMutable + Collection value) { + return transform(key, value); + } + }) <: @Mutable Collection + From complementary bound.: @Mutable Collection <= inference type: ? super V1 + @PolyMutable TransformedEntriesMultimap.@Mutable <: inference type: com.google.common.collect.Maps.EntryTransformer + @PolyMutable TransformedEntriesMultimap.@Mutable -> inference type: com.google.common.collect.Maps.EntryTransformer + new EntryTransformer, Collection>(){ + + () { + super(); + } + + @Override + @PolyMutable + public Collection transformEntry(@ParametricNullness + K key, @PolyMutable + Collection value) { + return transform(key, value); + } + } -> inference type: com.google.common.collect.Maps.EntryTransformer + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1568,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable TransformedEntriesMultimap.@Mutable Entries + method return type: @PolyMutable Collection<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1573,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Iterator<@Mutable Entry> + method return type: @Mutable Iterator<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1573,32] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Iterators.transform + unsatisfiable constraint: @PolyMutable Entry <: @Mutable Entry + use of F from Iterators.transform(fromMultimap.entries().iterator(), Maps.asEntryToEntryFunction(transformer)) <: @Mutable Entry + From complementary bound.: @Mutable Entry <= inference type: ? super F + @Mutable Function<@Mutable Entry, @Mutable Entry> <: inference type: com.google.common.base.Function + @Mutable Function<@Mutable Entry, @Mutable Entry> -> inference type: com.google.common.base.Function + Maps.asEntryToEntryFunction(transformer) -> inference type: com.google.common.base.Function + From: Argument constraint + @Mutable Entry <: @PolyMutable Entry + use of T from Iterators.transform(fromMultimap.entries().iterator(), Maps.asEntryToEntryFunction(transformer)) <: @PolyMutable Entry + From complementary bound.: use of T from Iterators.transform(fromMultimap.entries().iterator(), Maps.asEntryToEntryFunction(transformer)) <= @PolyMutable Entry + inference type: java.util.Iterator <: @Mutable Iterator<@PolyMutable Entry> + inference type: java.util.Iterator -> @Mutable Iterator<@PolyMutable Entry> + From: Constraint between method call type and target type for method call:Iterators.transform(fromMultimap.entries().iterator(), Maps.asEntryToEntryFunction(transformer)) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1579,22] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Collection + method return type: @PolyMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1579,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter values of TransformedEntriesMultimap.transform. + found : @PolyMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1615,17] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1615,32] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove(java.lang.Object) not allowed on the given receiver. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1621,23] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1636,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Collection + method return type: @PolyMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1636,35] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Collections2.transform + unsatisfiable constraint: @PolyMutable Entry <: @Mutable Entry + use of F from Collections2.transform(fromMultimap.entries(), Maps.asEntryToValueFunction(transformer)) <: @Mutable Entry + From complementary bound.: @Mutable Entry <= inference type: ? super F + @Mutable Function<@Mutable Entry, V2 extends @Readonly Object> <: inference type: com.google.common.base.Function + @Mutable Function<@Mutable Entry, V2 extends @Readonly Object> -> inference type: com.google.common.base.Function + Maps.asEntryToValueFunction(transformer) -> inference type: com.google.common.base.Function + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1653,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable List + method return type: @PolyMutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1653,29] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Collection" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1653,76] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter transformer of Maps.asValueToValueFunction. + found : @ReceiverDependentMutable EntryTransformer + required: @Mutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1664,23] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1710,16] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableListMultimap + method return type: @Immutable ImmutableListMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1756,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of Builder.put. + found : V extends @Readonly Object + required: V extends @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1773,46] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backingIterator of constructor. + found : @Mutable Iterator<@PolyMutable Entry>> + required: @Mutable Iterator>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1805,27] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to asMap() not allowed on the given receiver. + found : @PICOLost Multimap + required: @PICOLost Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1825,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Maps.safeGet. + found : @PICOLost Map> + required: @Readonly Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1825,56] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to asMap() not allowed on the given receiver. + found : @PICOLost Multimap + required: @PICOLost Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1885,32] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1894,32] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1918,28] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to keySet() not allowed on the given receiver. + found : @PICOLost Multimap + required: @PICOLost Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1923,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable AsMap.@Mutable EntrySet + method return type: @PolyMutable Set<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1927,30] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove(java.lang.Object) not allowed on the given receiver. + found : @ReceiverDependentMutable Set + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1936,20] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable AsMap + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1957,47] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1967,24] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to containsKey(@org.checkerframework.checker.signedness.qual.UnknownSignedness,@org.checkerframework.checker.pico.qual.Readonly java.lang.Object) not allowed on the given receiver. + found : @PolyMutable AsMap + required: @Mutable AsMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[1967,45] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multimaps.java:[2293,28] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Multimap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[413,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@Readonly WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[422,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@Readonly WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[428,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@Readonly WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[434,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@Readonly WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[460,45] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Collection + required: @ReceiverDependentMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[463,49] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator + required: @ReceiverDependentMutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[490,36] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @ReceiverDependentMutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[495,31] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove() not allowed on the given receiver. + found : @ReceiverDependentMutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[502,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Iterator + method return type: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[508,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[510,36] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to add(E) not allowed on the given receiver. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[514,18] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to addToMap() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[522,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + method return type: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[533,39] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to addAll(java.util.Collection) not allowed on the given receiver. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[538,18] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to addToMap() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[546,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[552,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[562,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[564,19] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to removeIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[568,86] [[immutability, pico, piconoinit, allcheckers]:type.anno.before.decl.anno] write type annotations [@Mutable] immediately before type, after declaration annotation @CheckForNull +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[568,86] [[immutability, pico, piconoinit, allcheckers]:type.invalid.conflicting.annos] invalid type: conflicting annotations [@Mutable, @Readonly] in type "@Mutable @Readonly Object" +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[569,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[570,39] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove(java.lang.Object) not allowed on the given receiver. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[570,40] [[immutability, pico, piconoinit, allcheckers]:type.invalid.conflicting.annos] invalid type: conflicting annotations [@Mutable, @Readonly] in type "@Mutable @Readonly Object" +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[573,21] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to removeIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[584,42] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to removeAll(java.util.Collection) not allowed on the given receiver. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[588,21] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to removeIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[597,42] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to retainAll(java.util.Collection) not allowed on the given receiver. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[601,21] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to removeIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[654,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Collection" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[666,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedSortedSet + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[673,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedSortedSet + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[679,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedSortedSet + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[683,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter ancestor of WrappedSortedSet constructor. + found : @Mutable AbstractMapBasedMultimap.@Readonly WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[688,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedSortedSet + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[692,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter ancestor of WrappedSortedSet constructor. + found : @Mutable AbstractMapBasedMultimap.@Readonly WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[697,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedSortedSet + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[701,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter ancestor of WrappedSortedSet constructor. + found : @Mutable AbstractMapBasedMultimap.@Readonly WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[717,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable SortedSet" to "@PolyMutable NavigableSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[757,75] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter ancestor of WrappedNavigableSet constructor. + found : @Mutable AbstractMapBasedMultimap.@Readonly WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[762,54] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter wrapped of WrappedNavigableSet.wrap. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[777,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter wrapped of WrappedNavigableSet.wrap. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[782,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter wrapped of WrappedNavigableSet.wrap. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[787,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter wrapped of WrappedNavigableSet.wrap. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[797,27] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter ancestor of WrappedCollection constructor. + found : @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[801,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Collection" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[815,18] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to addToMap() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[824,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[831,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[837,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[842,16] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to addToMap() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[849,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[852,19] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to removeIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[858,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[864,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[870,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[876,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[882,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to refreshIfEmpty() not allowed on the given receiver. + found : @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable WrappedList + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[886,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter ancestor of AbstractMapBasedMultimap.wrapList. + found : @Mutable AbstractMapBasedMultimap.@Readonly WrappedCollection + required: @Mutable AbstractMapBasedMultimap.@Mutable WrappedCollection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[895,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegateIterator of WrappedIterator constructor. + found : @Mutable ListIterator + required: @ReceiverDependentMutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[959,46] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter subMap of NavigableKeySet constructor. + found : @PolyMutable NavigableMap> + required: @Mutable NavigableMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[961,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter subMap of SortedKeySet constructor. + found : @PolyMutable SortedMap> + required: @Mutable SortedMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[976,87] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@ReceiverDependentMutable Entry>> + required: @Readonly Iterator<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1014,45] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove(java.lang.Object) not allowed on the given receiver. + found : @ReceiverDependentMutable Map> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1017,24] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1049,12] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter subMap of KeySet constructor. + found : @Mutable SortedMap> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1053,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Map>" to "@Mutable SortedMap>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1187,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Maps.safeRemove. + found : @ReceiverDependentMutable Map> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1191,22] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1192,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AbstractMapBasedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1204,43] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@Mutable Entry>> + required: @ReceiverDependentMutable Iterator<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1207,55] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator + required: @ReceiverDependentMutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1220,59] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @ReceiverDependentMutable Iterator<@Mutable Entry>> + required: @Mutable Iterator<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1221,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable Itr +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1222,19] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable Itr +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1222,38] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Collection + required: @ReceiverDependentMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1223,22] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable AbstractMapBasedMultimap.@ReceiverDependentMutable Itr +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1223,43] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator + required: @ReceiverDependentMutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1229,70] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @ReceiverDependentMutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1234,26] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove() not allowed on the given receiver. + found : @ReceiverDependentMutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1240,26] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove() not allowed on the given receiver. + found : @ReceiverDependentMutable Iterator<@Mutable Entry>> + required: @Mutable Iterator<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1259,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable AbstractMapBasedMultimap.@Mutable Values + method return type: @PolyMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1289,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Keys + method return type: @PolyMutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1289,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Keys constructor. + found : @PolyMutable AbstractMapBasedMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1309,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable AbstractMapBasedMultimap.@Mutable EntrySet + method return type: @PolyMutable Collection<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1311,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable AbstractMapBasedMultimap.@Mutable Entries + method return type: @PolyMutable Collection<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1335,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator<@Immutable Entry> + method return type: @Mutable Spliterator<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1335,38] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CollectSpliterators.flatMap + unsatisfiable constraint: @Immutable Entry <: @PolyMutable Entry + @Immutable Entry <: @PolyMutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1356,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable AbstractMapBasedMultimap.@Mutable AsMap + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1356,21] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter submap of AsMap constructor. + found : @PolyMutable Map> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1361,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable AbstractMapBasedMultimap.@Mutable NavigableAsMap + method return type: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1361,32] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Map>" to "@Mutable NavigableMap>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1363,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable AbstractMapBasedMultimap.@Mutable SortedAsMap + method return type: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1363,29] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Map>" to "@Mutable SortedMap>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1365,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable AbstractMapBasedMultimap.@Mutable AsMap + method return type: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1365,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter submap of AsMap constructor. + found : @PolyMutable Map> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1384,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMapBasedMultimap.@PolyMutable AsMap.@Mutable AsMapEntries + method return type: @PolyMutable Set<@PolyMutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1402,12] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1403,27] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Collection + method return type: @PolyMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1408,49] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set + method return type: @PolyMutable Set<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1465,20] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMapBasedMultimap.@Mutable AsMap + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1475,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator<@Immutable Entry>> + method return type: @Mutable Spliterator<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1475,38] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CollectSpliterators.map + unsatisfiable constraint: @Immutable Entry> <: @Mutable Entry> + use of OutElementT from CollectSpliterators.map(submap.entrySet().spliterator(), AsMap.this::wrapEntry) <: @Mutable Entry> + From complementary bound.: use of OutElementT from CollectSpliterators.map(submap.entrySet().spliterator(), AsMap.this::wrapEntry) <= @Mutable Entry> + inference type: java.util.Spliterator <: @Mutable Spliterator<@Mutable Entry>> + inference type: java.util.Spliterator -> @Mutable Spliterator<@Mutable Entry>> + From: Constraint between method call type and target type for method call:CollectSpliterators.map(submap.entrySet().spliterator(), AsMap.this::wrapEntry) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1491,43] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1511,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry> + method return type: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1529,12] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter submap of AsMap constructor. + found : @ReceiverDependentMutable SortedMap> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1556,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMapBasedMultimap.@Mutable SortedAsMap + method return type: @PolyMutable SortedMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1556,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter submap of SortedAsMap constructor. + found : @PolyMutable SortedMap> + required: @Mutable SortedMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1562,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMapBasedMultimap.@PolyMutable SortedAsMap + method return type: @PolyMutable SortedMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1562,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter submap of SortedAsMap constructor. + found : @ReceiverDependentMutable SortedMap> + required: @PolyMutable SortedMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1567,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMapBasedMultimap.@PolyMutable SortedAsMap + method return type: @PolyMutable SortedMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1567,61] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter submap of SortedAsMap constructor. + found : @ReceiverDependentMutable SortedMap> + required: @PolyMutable SortedMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1577,45] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable AbstractMapBasedMultimap.@PolyMutable SortedAsMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1582,52] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter subMap of SortedKeySet constructor. + found : @PolyMutable SortedMap> + required: @Mutable SortedMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1590,12] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter submap of SortedAsMap constructor. + found : @Mutable NavigableMap> + required: @ReceiverDependentMutable SortedMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1595,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable SortedMap>" to "@Mutable NavigableMap>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1602,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry> + method return type: @PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1602,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of AsMap.wrapEntry. + found : @Mutable Entry> + required: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1614,88] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Entry> + required: @PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1615,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry> + method return type: @PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1615,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of AsMap.wrapEntry. + found : @PolyMutable Entry> + required: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1628,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry> + method return type: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1628,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of AsMap.wrapEntry. + found : @Mutable Entry> + required: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1641,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry> + method return type: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1641,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of AsMap.wrapEntry. + found : @Mutable Entry> + required: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1654,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry> + method return type: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1654,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of AsMap.wrapEntry. + found : @Mutable Entry> + required: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1661,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry> + method return type: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1661,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of AsMap.wrapEntry. + found : @Mutable Entry> + required: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1685,32] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Maps.immutableEntry + unsatisfiable constraint: @Readonly Collection <: @Mutable Collection + use of V from Maps.immutableEntry(entry.getKey(), unmodifiableCollectionSubclass(output)) = @Mutable Collection + From complementary bound.: use of V from Maps.immutableEntry(entry.getKey(), unmodifiableCollectionSubclass(output)) <= @Mutable Collection + inference type: @org.checkerframework.checker.pico.qual.Immutable java.util.Map.Entry <: @Immutable Entry> + inference type: @org.checkerframework.checker.pico.qual.Immutable java.util.Map.Entry -> @Immutable Entry> + From: Constraint between method call type and target type for method call:Maps.immutableEntry(entry.getKey(), unmodifiableCollectionSubclass(output)) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1690,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMapBasedMultimap.@PolyMutable NavigableAsMap + method return type: @PolyMutable NavigableMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1700,55] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter subMap of NavigableKeySet constructor. + found : @Mutable NavigableMap> + required: @Mutable NavigableMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1727,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMapBasedMultimap.@PolyMutable NavigableAsMap + method return type: @PolyMutable NavigableMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1737,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMapBasedMultimap.@PolyMutable NavigableAsMap + method return type: @PolyMutable NavigableMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java:[1749,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMapBasedMultimap.@PolyMutable NavigableAsMap + method return type: @PolyMutable NavigableMap> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSetMultimap.java:[70,39] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable Set" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java:[63,41] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to unmodifiableCollectionSubclass(@org.checkerframework.checker.pico.qual.Readonly java.util.Collection) not allowed on the given receiver. + found : @Readonly AbstractSortedSetMultimap + required: @PICOLost AbstractSortedSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java:[70,43] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable NavigableSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java:[72,47] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[100,41] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter c of AbstractCollection.retainAll. + found : @Readonly Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[100,41] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Readonly Collection <: @Mutable Collection + use of T from checkNotNull(c) <: @Mutable Collection + From complementary bound.: use of T from checkNotNull(c) -> @Mutable Collection + From: Constraint between method call type and target type for method call:checkNotNull(c) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[119,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of ImmutableEnumSet.asImmutable. + found : @Mutable EnumSet + required: @Immutable EnumSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[142,58] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of ImmutableEnumSet.asImmutable. + found : @Mutable EnumSet + required: @Immutable EnumSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[149,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of ImmutableEnumSet.asImmutable. + found : @Mutable EnumSet>> + required: @Immutable EnumSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[474,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Iterable" to "@Mutable Collection" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[475,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of Lists.newArrayList. + found : @Readonly Iterable + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[494,34] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection super @PICOBottom NullType ]> super @PICOBottom NullType ]>" to "@Mutable EnumSet super @PICOBottom NullType ]> super @PICOBottom NullType ]>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[516,31] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection super @PICOBottom NullType ]> super @PICOBottom NullType ]>" to "@Mutable EnumSet super @PICOBottom NullType ]> super @PICOBottom NullType ]>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[585,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of ImmutableSet.copyOf. + found : @ReceiverDependentMutable SetView + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[746,58] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator + required: @Immutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[747,58] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator + required: @Immutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[753,30] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[756,29] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[761,28] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to endOfData() not allowed on the given receiver. + found : @Mutable .@Immutable + required: @Mutable AbstractIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[832,47] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator + required: @Immutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[838,28] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[843,28] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to endOfData() not allowed on the given receiver. + found : @Mutable .@Immutable + required: @Mutable AbstractIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[904,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable UnmodifiableIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[975,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable UnmodifiableIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1054,20] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Set" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1059,32] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Set" to "@Mutable FilteredSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1064,42] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of FilteredSet constructor. + found : @Readonly Set + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1064,42] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Readonly Set <: @Mutable Set + use of T from checkNotNull(unfiltered) <: @Mutable Set + From complementary bound.: use of T from checkNotNull(unfiltered) -> @Mutable Set + From: Constraint between method call type and target type for method call:checkNotNull(unfiltered) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1172,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PICOLost Collection" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1177,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable FilteredSortedSet + method return type: @PolyMutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1178,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Collection" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1178,70] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of FilteredSortedSet constructor. + found : @PolyMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1183,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable FilteredSortedSet + method return type: @PolyMutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1183,39] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Collection" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1183,86] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of FilteredSortedSet constructor. + found : @PolyMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1188,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable FilteredSortedSet + method return type: @PolyMutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1188,39] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Collection" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1188,88] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of FilteredSortedSet constructor. + found : @PolyMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1194,51] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Iterators.find. + found : @PICOLost Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1200,38] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PICOLost Collection" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1203,27] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to apply(T) not allowed on the given receiver. + found : @PICOLost Predicate + required: @PICOLost Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1220,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Collection" to "@Mutable NavigableSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1226,81] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Iterators.find. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1232,80] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Iterators.find. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1238,59] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Iterables.find. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1244,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Iterables.find. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1250,57] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Iterables.removeFirstMatching. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1256,73] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Iterables.removeFirstMatching. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1261,55] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Sets.filter. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1266,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator + method return type: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1266,65] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter retainIfTrue of Iterators.filter. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1272,63] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Iterators.find. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1282,83] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Sets.filter. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1287,64] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Sets.filter. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1292,66] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Sets.filter. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1422,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSet<@Mutable List> + method return type: @Mutable Set<@Mutable List> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1428,10] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Readonly () not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1436,43] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableList + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1444,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of CartesianSet constructor. + found : @Immutable CartesianList + required: @Mutable CartesianList +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1444,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter axes of CartesianList constructor. + found : @Readonly ImmutableList<@Mutable List> + required: @Immutable ImmutableList<@Immutable List> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1447,105] [[immutability, pico, piconoinit, allcheckers]:type.invalid.annotations.on.use] invalid type: annotations [@ReceiverDependentMutable] conflict with declaration of type com.google.common.collect.CartesianList +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1449,22] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @ReceiverDependentMutable CartesianList + required: @Immutable CartesianList +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1454,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable CartesianList + method return type: @PolyMutable Collection<@Mutable List> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1462,21] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1481,31] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable CartesianSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1551,13] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Readonly SubSet.@Readonly (@Mutable SubSet this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1551,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Iterator + method return type: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1617,21] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Set" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1626,27] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable PowerSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1678,55] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of ImmutableSet.of. + found : @Immutable ImmutableSet + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1680,49] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of ImmutableSet.of. + found : @Immutable ImmutableSet + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1682,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set<@Mutable Set> + method return type: @Immutable Set<@Mutable Set> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1686,21] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Set" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1792,17] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Set" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1904,31] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable UnmodifiableNavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1905,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable UnmodifiableNavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[1912,43] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator + method return type: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[2001,20] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable Multiset" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[2028,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[2058,29] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to pollLast() not allowed on the given receiver. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[2064,30] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to pollFirst() not allowed on the given receiver. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[2069,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[2083,93] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[2093,64] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[2103,66] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[2147,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @ReceiverDependentMutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Sets.java:[2153,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of ForwardingCollection.standardToArray. + found : T extends @Mutable Object @Mutable [] + required: T extends @Mutable Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractIterator.java:[75,105] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.extends.clause] Class with annotation @ReceiverDependentMutable cannot extend @Immutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractIterator.java:[79,31] [[immutability, pico, piconoinit, allcheckers]:super.invocation.invalid] Constructor of type @ReceiverDependentMutable cannot call super() of type @Immutable. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractIterator.java:[149,27] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to tryToComputeNext() not allowed on the given receiver. + found : @Readonly AbstractIterator + required: @Mutable AbstractIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[146,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Predicate + required: @ReceiverDependentMutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[150,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of FilteredCollection constructor. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[150,69] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter first of Predicates.and. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[179,30] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to apply(T) not allowed on the given receiver. + found : @PICOLost Predicate + required: @PICOLost Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[193,28] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter iterable of Iterables.any. + found : @PICOLost Collection + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[193,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Iterables.any. + found : @PICOLost Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[198,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator + method return type: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[198,53] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter retainIfTrue of Iterators.filter. + found : @PICOLost Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[203,66] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of CollectSpliterators.filter. + found : @PICOLost Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[243,27] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to apply(T) not allowed on the given receiver. + found : @PICOLost Predicate + required: @PICOLost Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[299,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Function + required: @ReceiverDependentMutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[299,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Function <: @ReceiverDependentMutable Function + use of T from checkNotNull(function) <: @ReceiverDependentMutable Function + From complementary bound.: use of T from checkNotNull(function) -> @ReceiverDependentMutable Function + From: Constraint between method call type and target type for method call:checkNotNull(function) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[315,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Iterators.transform. + found : @PICOLost Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[321,67] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of CollectSpliterators.map. + found : @PICOLost Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[463,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable OrderedPermutationCollection + method return type: @Mutable Collection<@Mutable List> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[474,24] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Comparator + required: @Immutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[475,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter sortedInputList of OrderedPermutationCollection.calculateSize. + found : @Immutable ImmutableList + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[520,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter list of OrderedPermutationIterator constructor. + found : @Immutable ImmutableList + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[520,58] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter comparator of OrderedPermutationIterator constructor. + found : @Immutable Comparator + required: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[526,23] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[544,47] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable ArrayList + required: @ReceiverDependentMutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[544,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of Lists.newArrayList. + found : @ReceiverDependentMutable List + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[545,24] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Comparator + required: @ReceiverDependentMutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[552,24] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to endOfData() not allowed on the given receiver. + found : @ReceiverDependentMutable OrderedPermutationIterator + required: @Mutable AbstractIterator<@Mutable List> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[554,51] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of ImmutableList.copyOf. + found : @ReceiverDependentMutable List + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[556,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableList + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[562,24] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable OrderedPermutationIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[572,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter list of Collections.swap. + found : @ReceiverDependentMutable List + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[574,49] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter list of Collections.reverse. + found : @ReceiverDependentMutable List + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[626,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable PermutationCollection + method return type: @Mutable Collection<@Mutable List> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[626,61] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of ImmutableList.copyOf. + found : @Readonly Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[649,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter list of PermutationIterator constructor. + found : @Immutable ImmutableList + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[655,23] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[675,18] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable ArrayList + required: @ReceiverDependentMutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[677,10] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[678,10] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[679,18] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of Arrays.fill. + found : @Immutable int @ReceiverDependentMutable [] + required: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[680,18] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of Arrays.fill. + found : @Immutable int @ReceiverDependentMutable [] + required: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[688,24] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to endOfData() not allowed on the given receiver. + found : @ReceiverDependentMutable PermutationIterator + required: @Mutable AbstractIterator<@Mutable List> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[690,51] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of ImmutableList.copyOf. + found : @ReceiverDependentMutable List + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[692,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableList + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[696,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable PermutationIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[720,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter list of Collections.swap. + found : @ReceiverDependentMutable List + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[721,8] [[immutability, pico, piconoinit, allcheckers]:illegal.array.write] Cannot write array via receiver: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[727,6] [[immutability, pico, piconoinit, allcheckers]:illegal.array.write] Cannot write array via receiver: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[728,7] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable PermutationIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[737,51] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for HashMultiset.create + unsatisfiable constraint: @Readonly Object <: @Immutable Object + capture#074 extends @Readonly Object <: use of E from HashMultiset.create(first) + From complementary bound.: capture#074 extends @Readonly Object <= inference type: ? extends E + @Readonly List <: inference type: @org.checkerframework.checker.pico.qual.Readonly java.lang.Iterable + @Readonly List -> inference type: @org.checkerframework.checker.pico.qual.Readonly java.lang.Iterable + first -> inference type: @org.checkerframework.checker.pico.qual.Readonly java.lang.Iterable + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Collections2.java:[738,52] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for HashMultiset.create + unsatisfiable constraint: @Readonly Object <: @Immutable Object + capture#075 extends @Readonly Object <: use of E from HashMultiset.create(second) + From complementary bound.: capture#075 extends @Readonly Object <= inference type: ? extends E + @Readonly List <: inference type: @org.checkerframework.checker.pico.qual.Readonly java.lang.Iterable + @Readonly List -> inference type: @org.checkerframework.checker.pico.qual.Readonly java.lang.Iterable + second -> inference type: @org.checkerframework.checker.pico.qual.Readonly java.lang.Iterable + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingCollection.java:[141,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable Object @Mutable [] + method return type: @PolyMutable Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingCollection.java:[148,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: T extends @Readonly Object @Mutable [] + method return type: T extends @Readonly Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingCollection.java:[148,30] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of Collection.toArray. + found : T extends @Readonly Object @ReceiverDependentMutable [] + required: T extends @Readonly Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedSet.java:[93,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly SortedSet + method return type: @Mutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedSet.java:[128,41] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly ForwardingSortedSet" to "@Mutable SortedSet<@Mutable Object>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedSet.java:[129,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of SortedSet.tailSet. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedSet.java:[150,42] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of SortedSet.tailSet. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedSet.java:[174,39] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly SortedSet + method return type: @Mutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableSet.java:[192,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter forward of DescendingSet constructor. + found : @Mutable ForwardingNavigableSet + required: @ReceiverDependentMutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMultiset.java:[65,19] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to entrySet() not allowed on the given receiver. + found : @Readonly AbstractMultiset + required: @PICOLost AbstractMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMultiset.java:[168,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AbstractMultiset + method return type: @ReceiverDependentMutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMultiset.java:[173,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Iterator + method return type: @ReceiverDependentMutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMultiset.java:[186,24] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set<@Mutable Entry> + required: @ReceiverDependentMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMultiset.java:[188,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Set<@Mutable Entry> + method return type: @Mutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMultiset.java:[240,19] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to entrySet() not allowed on the given receiver. + found : @Readonly AbstractMultiset + required: @PICOLost AbstractMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMultiset.java:[252,19] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to entrySet() not allowed on the given receiver. + found : @Readonly AbstractMultiset + required: @PICOLost AbstractMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[133,23] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableMultiset + method return type: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[133,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Immutable ImmutableMultiset <: @Mutable Multiset + use of T from checkNotNull(multiset) <: @Mutable Multiset + From complementary bound.: use of T from checkNotNull(multiset) -> @Mutable Multiset + From: Constraint between method call type and target type for method call:checkNotNull(multiset) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[149,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Multiset" to "@Mutable Multiset" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[156,43] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[163,57] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set + required: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[163,57] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to createElementSet() not allowed on the given receiver. + found : @PolyMutable UnmodifiableMultiset + required: @Immutable UnmodifiableMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[177,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set + required: @PolyMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[177,23] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Immutable Set<@Mutable Entry>" to "@Mutable Set" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[346,35] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Predicate + required: @ReceiverDependentMutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[346,35] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Predicate <: @ReceiverDependentMutable Predicate + use of T from checkNotNull(predicate) <: @ReceiverDependentMutable Predicate + From complementary bound.: use of T from checkNotNull(predicate) -> @ReceiverDependentMutable Predicate + From: Constraint between method call type and target type for method call:checkNotNull(predicate) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[351,53] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter retainIfTrue of Iterators.filter. + found : @PICOLost Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[356,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Sets.filter. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[396,27] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to add(E,int) not allowed on the given receiver. + found : @ReceiverDependentMutable Multiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[405,52] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove(@org.checkerframework.checker.pico.qual.Readonly java.lang.Object,int) not allowed on the given receiver. + found : @ReceiverDependentMutable Multiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[479,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[485,37] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[542,37] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[614,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[620,37] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[692,37] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[867,33] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[906,25] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Multiset" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[931,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter iterable of Multisets.cast. + found : @Readonly Collection + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[944,25] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to forEachEntry(java.util.function.ObjIntConsumer) not allowed on the given receiver. + found : @Readonly Multiset + required: @PICOLost Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[952,15] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable Multiset" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[963,15] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Collection" to "@Mutable Multiset" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[1020,21] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to multiset() not allowed on the given receiver. + found : @Readonly ElementSet + required: @PICOLost ElementSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[1025,21] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to multiset() not allowed on the given receiver. + found : @Readonly ElementSet + required: @PICOLost ElementSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[1030,21] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to multiset() not allowed on the given receiver. + found : @Readonly ElementSet + required: @PICOLost ElementSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[1043,21] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to multiset() not allowed on the given receiver. + found : @Readonly ElementSet + required: @PICOLost ElementSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[1063,28] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to multiset() not allowed on the given receiver. + found : @Readonly EntrySet + required: @PICOLost EntrySet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[1082,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of Multiset.setCount. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[1096,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of MultisetIteratorImpl constructor. + found : @Readonly Multiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[1130,41] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[1193,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter c of Arrays.sort. + found : @Immutable DecreasingCount + required: @Mutable Comparator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multisets.java:[1231,23] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to elementSet() not allowed on the given receiver. + found : @Readonly ViewMultiset + required: @PICOLost AbstractMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMultiset.java:[92,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set + method return type: @ReceiverDependentMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMultiset.java:[98,30] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set<@Mutable Entry> + method return type: @ReceiverDependentMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMultiset.java:[133,17] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of ForwardingMultiset.count. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMultiset.java:[173,7] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to add(E,int) not allowed on the given receiver. + found : @ReceiverDependentMutable ForwardingMultiset + required: @Mutable ForwardingMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMultiset.java:[187,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter self of Multisets.addAllImpl. + found : @ReceiverDependentMutable ForwardingMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMultiset.java:[199,17] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove(java.lang.Object,int) not allowed on the given receiver. + found : @ReceiverDependentMutable ForwardingMultiset + required: @Mutable ForwardingMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMultiset.java:[199,18] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of ForwardingMultiset.remove. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMultiset.java:[211,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter self of Multisets.removeAllImpl. + found : @ReceiverDependentMutable ForwardingMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMultiset.java:[223,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter self of Multisets.retainAllImpl. + found : @ReceiverDependentMutable ForwardingMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[130,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Immutable EntryFunction" to "@Mutable Function" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[135,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Immutable EntryFunction" to "@Mutable Function" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[179,80] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@Readonly Entry>, capture#0117 extends V extends @Immutable Object>> + required: @Readonly Iterator>, ? extends V extends @Immutable Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[274,38] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter m of HashMap constructor. + found : @PolyMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[493,45] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Map" to "@Mutable SortedMap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[562,17] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter left of Maps.doDifference. + found : @Readonly Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[562,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter right of Maps.doDifference. + found : @Readonly Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[563,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable MapDifferenceImpl + method return type: @Mutable MapDifference +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[588,64] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Comparator + required: @Readonly Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[607,17] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter left of Maps.doDifference. + found : @Readonly SortedMap + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[607,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter right of Maps.doDifference. + found : @Readonly Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[608,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable SortedMapDifferenceImpl + method return type: @Mutable SortedMapDifference +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[648,47] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Map" to "@Mutable SortedMap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[656,30] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.implements.clause] Class with annotation @Immutable cannot implement @Mutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[718,27] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to entriesOnlyOnLeft() not allowed on the given receiver. + found : @Readonly MapDifferenceImpl + required: @Immutable MapDifferenceImpl +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[718,49] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to entriesOnlyOnRight() not allowed on the given receiver. + found : @Readonly MapDifferenceImpl + required: @Immutable MapDifferenceImpl +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[718,68] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to entriesInCommon() not allowed on the given receiver. + found : @Readonly MapDifferenceImpl + required: @Immutable MapDifferenceImpl +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[718,88] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to entriesDiffering() not allowed on the given receiver. + found : @Readonly MapDifferenceImpl + required: @Immutable MapDifferenceImpl +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[744,46] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.implements.clause] Class with annotation @Immutable cannot implement @Mutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[750,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ValueDifferenceImpl + method return type: @Mutable ValueDifference +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[796,68] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.implements.clause] Class with annotation @Immutable cannot implement @Mutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[939,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Function + required: @ReceiverDependentMutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[939,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Function <: @ReceiverDependentMutable Function + use of T from checkNotNull(function) <: @ReceiverDependentMutable Function + From complementary bound.: use of T from checkNotNull(function) -> @ReceiverDependentMutable Function + From: Constraint between method call type and target type for method call:checkNotNull(function) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[944,26] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set + method return type: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[944,37] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Maps.removeOnlySet. + found : @PolyMutable Set + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[949,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Collection + method return type: @PolyMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[949,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromCollection of Collections2.transform. + found : @PolyMutable Set + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[949,41] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Collections2.transform. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[973,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[983,29] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove(java.lang.Object) not allowed on the given receiver. + found : @ReceiverDependentMutable Set + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[985,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[994,24] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable Set + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1011,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable AsMapView.@Mutable EntrySetImpl + method return type: @PolyMutable Set<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1027,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1042,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Set" to "@Mutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1042,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedSet + method return type: @PolyMutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1053,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> + method return type: @PolyMutable Set<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1053,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Maps.removeOnlySortedSet. + found : @PolyMutable SortedSet + required: @Mutable SortedSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1058,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Maps.asMap. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1063,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Maps.asMap. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1068,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Maps.asMap. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1099,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Function + required: @ReceiverDependentMutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1099,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Function <: @ReceiverDependentMutable Function + use of T from checkNotNull(vFunction) <: @ReceiverDependentMutable Function + From complementary bound.: use of T from checkNotNull(vFunction) -> @ReceiverDependentMutable Function + From: Constraint between method call type and target type for method call:checkNotNull(vFunction) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1109,75] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Maps.asMap. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1114,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Maps.asMap. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1119,52] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Maps.asMap. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1139,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1140,29] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to apply(F) not allowed on the given receiver. + found : @PICOLost Function + required: @PICOLost Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1153,37] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Maps.asMapEntryIterator. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1158,36] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator<@Immutable Entry> + method return type: @Mutable Spliterator<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1158,36] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CollectSpliterators.map + unsatisfiable constraint: @Immutable Entry <: @PolyMutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1173,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> + method return type: @PolyMutable NavigableSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1173,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Maps.removeOnlyNavigableSet. + found : @PolyMutable NavigableSet + required: @Mutable NavigableSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1183,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Maps.asMap. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1541,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Readonly () not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1549,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1549,51] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Readonly Iterator<@Mutable Entry> + required: @Mutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1571,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator<@Mutable Entry> + method return type: @Mutable Iterator<@Readonly Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1571,55] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryIterator of Maps.unmodifiableEntryIterator. + found : @Mutable Iterator<@Readonly Entry> + required: @Readonly Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1586,39] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly Object @Immutable [] + required: @Mutable Object @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1587,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Object @Immutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1593,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of ForwardingCollection.standardToArray. + found : T extends @Readonly Object @Mutable [] + required: T extends @Readonly Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1643,119] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.extends.clause] Class with annotation @ReceiverDependentMutable cannot extend @Mutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1646,64] [[immutability, pico, piconoinit, allcheckers]:super.invocation.invalid] Constructor of type @ReceiverDependentMutable cannot call super() of type @Mutable. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1670,36] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable BiMapConverter" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1737,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableBiMap + method return type: @Mutable BiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1821,20] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable UnmodifiableBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[1829,39] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable UnmodifiableBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2241,37] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable EntryTransformer + required: @ReceiverDependentMutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2241,37] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable EntryTransformer <: @ReceiverDependentMutable EntryTransformer + use of T from checkNotNull(transformer) <: @ReceiverDependentMutable EntryTransformer + From complementary bound.: use of T from checkNotNull(transformer) -> @ReceiverDependentMutable EntryTransformer + From: Constraint between method call type and target type for method call:checkNotNull(transformer) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2268,41] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to transformEntry(K,V1) not allowed on the given receiver. + found : @PICOLost EntryTransformer + required: @PICOLost EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2268,42] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2280,39] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2296,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Iterator<@Mutable Entry> + method return type: @Mutable Iterator<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2296,32] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Iterators.transform + unsatisfiable constraint: @PolyMutable Entry <: @Mutable Entry + use of F from Iterators.transform(fromMap.entrySet().iterator(), Maps.asEntryToEntryFunction(transformer)) <: @Mutable Entry + From complementary bound.: @Mutable Entry <= inference type: ? super F + @Mutable Function<@Mutable Entry, @Mutable Entry> <: inference type: com.google.common.base.Function + @Mutable Function<@Mutable Entry, @Mutable Entry> -> inference type: com.google.common.base.Function + Maps.asEntryToEntryFunction(transformer) -> inference type: com.google.common.base.Function + From: Argument constraint + @Mutable Entry <: @PolyMutable Entry + use of T from Iterators.transform(fromMap.entrySet().iterator(), Maps.asEntryToEntryFunction(transformer)) <: @PolyMutable Entry + From complementary bound.: use of T from Iterators.transform(fromMap.entrySet().iterator(), Maps.asEntryToEntryFunction(transformer)) <= @PolyMutable Entry + inference type: java.util.Iterator <: @Mutable Iterator<@PolyMutable Entry> + inference type: java.util.Iterator -> @Mutable Iterator<@PolyMutable Entry> + From: Constraint between method call type and target type for method call:Iterators.transform(fromMap.entrySet().iterator(), Maps.asEntryToEntryFunction(transformer)) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2302,36] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator<@Mutable Entry> + method return type: @Mutable Spliterator<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2302,36] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CollectSpliterators.map + unsatisfiable constraint: @PolyMutable Entry <: @Mutable Entry + use of InElementT from CollectSpliterators.map(fromMap.entrySet().spliterator(), Maps.asEntryToEntryFunction(transformer)) <: @Mutable Entry + From complementary bound.: @Mutable Entry <= inference type: ? super InElementT + @Mutable Function<@Mutable Entry, @Mutable Entry> <: inference type: java.util.function.Function + @Mutable Function<@Mutable Entry, @Mutable Entry> -> inference type: java.util.function.Function + Maps.asEntryToEntryFunction(transformer) -> inference type: java.util.function.Function + From: Argument constraint + @Mutable Entry <: @PolyMutable Entry + use of OutElementT from CollectSpliterators.map(fromMap.entrySet().spliterator(), Maps.asEntryToEntryFunction(transformer)) <: @PolyMutable Entry + From complementary bound.: use of OutElementT from CollectSpliterators.map(fromMap.entrySet().spliterator(), Maps.asEntryToEntryFunction(transformer)) <= @PolyMutable Entry + inference type: java.util.Spliterator <: @Mutable Spliterator<@PolyMutable Entry> + inference type: java.util.Spliterator -> @Mutable Spliterator<@PolyMutable Entry> + From: Constraint between method call type and target type for method call:CollectSpliterators.map(fromMap.entrySet().spliterator(), Maps.asEntryToEntryFunction(transformer)) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2347,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedMap + method return type: @PolyMutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2347,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformEntries. + found : @PolyMutable SortedMap + required: @Mutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2347,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter transformer of Maps.transformEntries. + found : @PolyMutable EntryTransformer + required: @Mutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2358,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedMap + method return type: @PolyMutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2358,46] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformEntries. + found : @PolyMutable SortedMap + required: @Mutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2358,64] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter transformer of Maps.transformEntries. + found : @PolyMutable EntryTransformer + required: @Mutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2363,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedMap + method return type: @PolyMutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2363,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformEntries. + found : @PolyMutable SortedMap + required: @Mutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2363,58] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter transformer of Maps.transformEntries. + found : @PolyMutable EntryTransformer + required: @Mutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2381,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of TransformedEntriesNavigableMap.transformEntry. + found : @PolyMutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2397,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableMap + method return type: @PolyMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2397,53] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformEntries. + found : @PolyMutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2397,57] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter transformer of Maps.transformEntries. + found : @PolyMutable EntryTransformer + required: @Mutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2403,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of TransformedEntriesNavigableMap.transformEntry. + found : @PolyMutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2409,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of TransformedEntriesNavigableMap.transformEntry. + found : @PolyMutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2425,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableMap + method return type: @PolyMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2425,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformEntries. + found : @PolyMutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2425,67] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter transformer of Maps.transformEntries. + found : @PolyMutable EntryTransformer + required: @Mutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2431,49] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of TransformedEntriesNavigableMap.transformEntry. + found : @PolyMutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2443,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of TransformedEntriesNavigableMap.transformEntry. + found : @PolyMutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2449,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of TransformedEntriesNavigableMap.transformEntry. + found : @PolyMutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2482,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableMap + method return type: @PolyMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2483,26] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformEntries. + found : @PolyMutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2483,72] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter transformer of Maps.transformEntries. + found : @PolyMutable EntryTransformer + required: @Mutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2498,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableMap + method return type: @PolyMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2498,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformEntries. + found : @PolyMutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2498,69] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter transformer of Maps.transformEntries. + found : @PolyMutable EntryTransformer + required: @Mutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2503,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Entry + method return type: @PolyMutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2503,58] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter transformer of Maps.transformEntry. + found : @PolyMutable EntryTransformer + required: @Mutable EntryTransformer +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2508,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable SortedMap" to "@Mutable NavigableMap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2508,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableMap + method return type: @PolyMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2970,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Predicate> + required: @ReceiverDependentMutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2977,12] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2978,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter input of Predicate.apply. + found : @Immutable Entry + required: capture#0164 extends @Readonly Object super @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[2999,49] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to apply(@org.checkerframework.checker.pico.qual.Readonly java.lang.Object,V) not allowed on the given receiver. + found : @Readonly AbstractFilteredMap + required: @PICOLost AbstractFilteredMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3006,38] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to apply(@org.checkerframework.checker.pico.qual.Readonly java.lang.Object,V) not allowed on the given receiver. + found : @Readonly AbstractFilteredMap + required: @PICOLost AbstractFilteredMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3023,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of FilteredMapValues constructor. + found : @PolyMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3023,68] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of FilteredMapValues constructor. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3037,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Map + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3038,27] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Predicate> + required: @ReceiverDependentMutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3042,116] [[immutability, pico, piconoinit, allcheckers]:type.anno.before.decl.anno] write type annotations [@Readonly] immediately before type, after declaration annotation @CheckForNull +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3083,83] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of FilteredMapValues. + found : K extends @PolyMutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3085,55] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @Mutable [] + method return type: @PolyMutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3105,26] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Predicate + required: @ReceiverDependentMutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3110,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set<@PolyMutable Entry> + method return type: @PolyMutable Set<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3110,24] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Sets.filter + unsatisfiable constraint: @PolyMutable Entry <: @Mutable Entry + use of E from Sets.filter(unfiltered.entrySet(), predicate) <: capture#0113 extends @Readonly Object super @Mutable Entry + From complementary bound.: capture#0113 extends @Readonly Object super @Mutable Entry <= inference type: ? super E + @PolyMutable Predicate> <: inference type: com.google.common.base.Predicate + @PolyMutable Predicate> -> inference type: com.google.common.base.Predicate + predicate -> inference type: com.google.common.base.Predicate + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3115,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set + method return type: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3115,46] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Sets.filter. + found : @PolyMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3124,62] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to apply(T) not allowed on the given receiver. + found : @PICOLost Predicate + required: @PICOLost Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3124,63] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3138,24] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of AbstractFilteredMap constructor. + found : @Mutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3139,36] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set<@ReceiverDependentMutable Entry> + required: @ReceiverDependentMutable Set<@ReceiverDependentMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3139,36] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Sets.filter + unsatisfiable constraint: @ReceiverDependentMutable Entry <: @Mutable Entry + use of E from Sets.filter(unfiltered.entrySet(), predicate) <: capture#0114 extends @Readonly Object super @Mutable Entry + From complementary bound.: capture#0114 extends @Readonly Object super @Mutable Entry <= inference type: ? super E + @ReceiverDependentMutable Predicate> <: inference type: com.google.common.base.Predicate + @ReceiverDependentMutable Predicate> -> inference type: com.google.common.base.Predicate + predicate -> inference type: com.google.common.base.Predicate + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3144,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable FilteredEntryMap.@Mutable EntrySet + method return type: @PolyMutable Set<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3153,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set<@Mutable Entry> + method return type: @Mutable Set<@Readonly Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3216,30] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of KeySet constructor. + found : @Mutable FilteredEntryMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3241,53] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Object @Mutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3263,24] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryPredicate of FilteredEntryMap constructor. + found : @Mutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3277,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable FilteredEntrySortedMap.@Mutable SortedKeySet + method return type: @PolyMutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3293,15] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Set" to "@PolyMutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3298,15] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Set" to "@PolyMutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3303,15] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Set" to "@PolyMutable SortedSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3340,17] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to apply(@org.checkerframework.checker.pico.qual.Readonly java.lang.Object,V) not allowed on the given receiver. + found : @Readonly FilteredEntrySortedMap + required: @PICOLost AbstractFilteredMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3349,83] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryPredicate of FilteredEntrySortedMap constructor. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3354,91] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryPredicate of FilteredEntrySortedMap constructor. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3359,85] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryPredicate of FilteredEntrySortedMap constructor. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3381,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Predicate> + required: @ReceiverDependentMutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3382,30] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable FilteredEntryMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3382,53] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of FilteredEntryMap constructor. + found : @ReceiverDependentMutable NavigableMap + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3382,65] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryPredicate of FilteredEntryMap constructor. + found : @Mutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3393,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> + method return type: @PolyMutable NavigableSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3393,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of constructor. + found : @PolyMutable FilteredEntryNavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3408,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of FilteredMapValues constructor. + found : @PolyMutable NavigableMap + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3408,68] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of FilteredMapValues constructor. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3413,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@PolyMutable Entry> + method return type: @Mutable Iterator<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3413,64] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter retainIfTrue of Iterators.filter. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3418,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@PolyMutable Entry> + method return type: @Mutable Iterator<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3418,80] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter retainIfTrue of Iterators.filter. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3428,27] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Iterables.any + unsatisfiable constraint: @PICOLost Entry <: @PICOLost Entry + use of T from Iterables.any(unfiltered.entrySet(), entryPredicate) <: capture#0115 extends @Readonly Object super @PICOLost Entry + From complementary bound.: capture#0115 extends @Readonly Object super @PICOLost Entry <= inference type: ? super T + @PICOLost Predicate> <: inference type: com.google.common.base.Predicate + @PICOLost Predicate> -> inference type: com.google.common.base.Predicate + entryPredicate -> inference type: com.google.common.base.Predicate + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3483,26] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableMap + method return type: @PolyMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3483,51] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of Maps.filterEntries. + found : @PolyMutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3483,55] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryPredicate of Maps.filterEntries. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3493,26] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableMap + method return type: @PolyMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3494,27] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of Maps.filterEntries. + found : @PolyMutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3494,73] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryPredicate of Maps.filterEntries. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3499,26] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableMap + method return type: @PolyMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3499,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of Maps.filterEntries. + found : @PolyMutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3499,65] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryPredicate of Maps.filterEntries. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3504,26] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableMap + method return type: @PolyMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3504,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of Maps.filterEntries. + found : @PolyMutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3504,67] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryPredicate of Maps.filterEntries. + found : @PolyMutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3519,59] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter input of Predicate.apply. + found : @Immutable Entry + required: capture#0184 extends @Readonly Object super @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3527,97] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of FilteredEntryBiMap constructor. + found : @Mutable Predicate<@Mutable Entry> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3527,98] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter forwardPredicate of FilteredEntryBiMap.inversePredicate. + found : @Mutable Predicate> + required: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3552,53] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter input of Predicate.apply. + found : @Immutable Entry + required: capture#0186 extends @Readonly Object super @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3595,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableNavigableMap + method return type: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3602,27] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3612,22] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly NavigableMap + required: @Immutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3617,22] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly NavigableMap + required: @Immutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3618,27] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly UnmodifiableNavigableMap + required: @Immutable UnmodifiableNavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3629,51] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of Maps.unmodifiableOrNull. + found : @Immutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3641,51] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of Maps.unmodifiableOrNull. + found : @Immutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3653,53] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of Maps.unmodifiableOrNull. + found : @Immutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3665,52] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of Maps.unmodifiableOrNull. + found : @Immutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3677,51] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of Maps.unmodifiableOrNull. + found : @Immutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3683,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of Maps.unmodifiableOrNull. + found : @Immutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3755,26] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable UnmodifiableNavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3786,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Maps.unmodifiableNavigableMap. + found : @Immutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3796,59] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Maps.unmodifiableNavigableMap. + found : @Immutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3806,59] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Maps.unmodifiableNavigableMap. + found : @Immutable NavigableMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3884,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PolyMutable Set<@PolyMutable Entry> + required: @Readonly Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3885,30] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable Set<@Readonly Entry<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Readonly Object>> + method return type: @PolyMutable Set<@PolyMutable Entry<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Readonly Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3885,41] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable ViewCachingAbstractMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3898,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable KeySet + method return type: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3898,26] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of KeySet constructor. + found : @PolyMutable ViewCachingAbstractMap + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3931,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable Set<@PolyMutable Entry<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Readonly Object>> + method return type: @Mutable Set<@PolyMutable Entry<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Readonly Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3931,47] [[immutability, pico, piconoinit, allcheckers]:constructor.return.invalid] Invalid constructor return type: @Mutable IteratorBasedAbstractMap.@PolyMutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[3955,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter action of Iterator.forEachRemaining. + found : @Mutable Consumer> + required: @Mutable Consumer> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4033,40] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@PolyMutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4051,38] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@PolyMutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4059,20] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Map" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4351,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter c of AbstractCollection.retainAll. + found : @Readonly Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4351,43] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Readonly Collection <: @Mutable Collection + use of T from checkNotNull(c) <: @Mutable Collection + From complementary bound.: use of T from checkNotNull(c) -> @Mutable Collection + From: Constraint between method call type and target type for method call:checkNotNull(c) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4402,28] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4422,28] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4444,68] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Sets.newHashSetWithExpectedSize + unsatisfiable constraint: @Mutable Object <: @Immutable Object + use of E from Sets.newHashSetWithExpectedSize(c.size()) = @Mutable Object + From complementary bound.: use of E from Sets.newHashSetWithExpectedSize(c.size()) <= @Mutable Object + inference type: java.util.HashSet <: @Readonly Set<@Mutable Object> + inference type: java.util.HashSet -> @Readonly Set<@Mutable Object> + From: Constraint between method call type and target type for method call:Sets.newHashSetWithExpectedSize(c.size()) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4451,32] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4452,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of Set.add. + found : @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4483,28] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable DescendingMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4605,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable DescendingMap.@Mutable EntrySetImpl + method return type: @PolyMutable Set<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4618,50] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableKeySet + required: @PolyMutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Maps.java:[4618,72] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of NavigableKeySet constructor. + found : @PolyMutable DescendingMap + required: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractNavigableMap.java:[167,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableKeySet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Readonly Object> + method return type: @PolyMutable NavigableSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractNavigableMap.java:[167,38] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of NavigableKeySet constructor. + found : @PolyMutable AbstractNavigableMap + required: @Mutable NavigableMap<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/Converter.java:[251,46] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for NullnessCasts.uncheckedCastNullableTToT + unsatisfiable constraint: A extends @Readonly Object <: @Mutable Object + A extends @Readonly Object <: use of T from uncheckedCastNullableTToT(a) + From complementary bound.: A extends @Readonly Object -> use of T from uncheckedCastNullableTToT(a) + a -> use of T from uncheckedCastNullableTToT(a) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/Converter.java:[256,47] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for NullnessCasts.uncheckedCastNullableTToT + unsatisfiable constraint: B extends @Readonly Object <: @Mutable Object + B extends @Readonly Object <: use of T from uncheckedCastNullableTToT(b) + From complementary bound.: B extends @Readonly Object -> use of T from uncheckedCastNullableTToT(b) + b -> use of T from uncheckedCastNullableTToT(b) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMap.java:[180,26] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Maps.putAllImpl. + found : @Readonly Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMap.java:[233,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of KeySet constructor. + found : @Mutable ForwardingMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMap.java:[263,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Values constructor. + found : @Mutable ForwardingMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingMapEntry.java:[113,25] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedMap.java:[128,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Comparable<@Mutable Object>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedMap.java:[128,59] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of Comparable.compareTo. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedMap.java:[130,65] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of Comparator.compare. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedMap.java:[130,69] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg1 of Comparator.compare. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedMap.java:[147,16] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of SortedMap. + found : @Mutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedMap.java:[147,44] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable ForwardingSortedMap" to "@Mutable SortedMap<@Mutable Object, V [ extends @Readonly Object super @PICOBottom NullType ]>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[204,39] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for LinkedHashMultiset.create + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + capture#0215 extends E extends @Readonly Object <: use of E from LinkedHashMultiset.create(elements) + From complementary bound.: capture#0215 extends E extends @Readonly Object <= inference type: ? extends E + @Mutable Iterable <: inference type: java.lang.Iterable + @Mutable Iterable -> inference type: java.lang.Iterable + elements -> inference type: java.lang.Iterable + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[216,52] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for LinkedHashMultiset.create + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + use of E from LinkedHashMultiset.create() = E extends @Readonly Object + From complementary bound.: use of E from LinkedHashMultiset.create() <= E extends @Readonly Object + inference type: com.google.common.collect.LinkedHashMultiset <: @Readonly Multiset + inference type: com.google.common.collect.LinkedHashMultiset -> @Readonly Multiset + From: Constraint between method call type and target type for method call:LinkedHashMultiset.create() +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[222,52] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for LinkedHashMultiset.create + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + use of E from LinkedHashMultiset.create() = E extends @Readonly Object + From complementary bound.: use of E from LinkedHashMultiset.create() <= E extends @Readonly Object + inference type: com.google.common.collect.LinkedHashMultiset <: @Readonly Multiset + inference type: com.google.common.collect.LinkedHashMultiset -> @Readonly Multiset + From: Constraint between method call type and target type for method call:LinkedHashMultiset.create() +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[241,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable ImmutableMultiset.@Readonly (@Immutable ImmutableMultiset this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[241,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[253,45] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable Iterator<@Mutable Entry> + required: @Mutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[273,37] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ImmutableMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[375,36] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ImmutableMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[441,30] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSet<@Mutable Entry> + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[448,30] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of SerializedForm constructor. + found : @Immutable ImmutableMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[487,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter contents of Builder constructor. + found : @Mutable LinkedHashMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[602,46] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for JdkBackedImmutableMultiset.create + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + E extends @Readonly Object <: use of E from JdkBackedImmutableMultiset.create(contents.entrySet()) + From complementary bound.: E extends @Readonly Object <= inference type: ? extends E + @Mutable Entry <: inference type: com.google.common.collect.Multiset.Entry + @Mutable Entry <= inference type: ? extends com.google.common.collect.Multiset.Entry + @Mutable Set<@Mutable Entry> <: inference type: java.util.Collection> + @Mutable Set<@Mutable Entry> -> inference type: java.util.Collection> + contents.entrySet() -> inference type: java.util.Collection> + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[613,21] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable List<@Mutable Entry> + required: @Immutable List<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[614,22] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Multiset + required: @Immutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[658,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of AbstractMapBasedMultiset.add. + found : @Mutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[660,37] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableMultiset<@Immutable Object> + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMultiset.java:[660,37] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableMultiset.copyOf + unsatisfiable constraint: inference type: com.google.common.collect.ImmutableMultiset <: @Mutable Object + inference type: com.google.common.collect.ImmutableMultiset -> @Mutable Object + From: Constraint between method call type and target type for method call:ImmutableMultiset.copyOf(multiset) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/IndexedImmutableSet.java:[65,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable IndexedImmutableSet.@Readonly (@Immutable IndexedImmutableSet this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/IndexedImmutableSet.java:[65,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly ImmutableList + method return type: @Immutable ImmutableList +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Multiset.java:[499,37] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of Multisets.spliteratorImpl. + found : @Readonly Multiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ObjectArrays.java:[65,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter reference of Platform.newArray. + found : T extends @Readonly Object @Readonly [] + required: T extends @Readonly Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ObjectArrays.java:[138,14] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of ObjectArrays.fillArray. + found : @Readonly Collection + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ObjectArrays.java:[138,17] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of ObjectArrays.fillArray. + found : T extends @Readonly Object @Readonly [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ObjectArrays.java:[140,51] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : T extends @Readonly Object @Readonly [] + required: @Mutable Object @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ObjectArrays.java:[141,6] [[immutability, pico, piconoinit, allcheckers]:illegal.array.write] Cannot write array via receiver: @Mutable Object @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ObjectArrays.java:[143,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: T extends @Readonly Object @Readonly [] + method return type: T extends @Readonly Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ObjectArrays.java:[163,51] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : T extends @Readonly Object @Mutable [] + required: @Mutable Object @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ObjectArrays.java:[204,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ObjectArrays.java:[226,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @Readonly [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ObjectArrays.java:[236,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableList.java:[43,82] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of RegularImmutableList constructor. + found : @Mutable Object @Mutable [] + required: @Mutable Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableList.java:[64,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Object @Immutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableList.java:[95,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of Iterators.forArray. + found : @Mutable Object @Immutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableList.java:[100,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator + method return type: @Mutable Spliterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[573,19] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from create(newLower, newUpper) + From complementary bound.: C extends @Readonly Comparable <= use of C from create(newLower, newUpper) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + newLower -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[614,17] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from create(firstRange.upperBound, secondRange.lowerBound) + From complementary bound.: C extends @Readonly Comparable <= use of C from create(firstRange.upperBound, secondRange.lowerBound) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + firstRange.upperBound -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[638,19] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from create(newLower, newUpper) + From complementary bound.: C extends @Readonly Comparable <= use of C from create(newLower, newUpper) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + newLower -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[670,71] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from create(lower, upper) + From complementary bound.: C extends @Readonly Comparable <= use of C from create(lower, upper) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + lower -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[714,16] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Range<@Mutable Comparable> + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[714,16] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.all + unsatisfiable constraint: inference type: com.google.common.collect.Range <: @Mutable Object + inference type: com.google.common.collect.Range -> @Mutable Object + From: Constraint between method call type and target type for method call:all() +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[716,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Range> + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[732,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter left of ComparisonChain.compare. + found : @Immutable Cut> + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[732,41] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter right of ComparisonChain.compare. + found : @Immutable Cut> + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[733,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter left of ComparisonChain.compare. + found : @Immutable Cut> + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Range.java:[733,41] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter right of ComparisonChain.compare. + found : @Immutable Cut> + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Ordering.java:[256,19] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Ordering.explicit + unsatisfiable constraint: T extends @Readonly Object <: @Immutable Object + T extends @Readonly Object <: use of T from explicit(Lists.asList(leastValue, remainingValuesInOrder)) + From complementary bound.: use of E from Lists.asList(leastValue, remainingValuesInOrder) = use of T from explicit(Lists.asList(leastValue, remainingValuesInOrder)) + From complementary bound.: use of E from Lists.asList(leastValue, remainingValuesInOrder) <= use of T from explicit(Lists.asList(leastValue, remainingValuesInOrder)) + inference type: java.util.List <: inference type: java.util.List + inference type: java.util.List -> inference type: java.util.List + From: Constraint between method call type and target type for method call:Lists.asList(leastValue, remainingValuesInOrder) + T extends @Readonly Object <: @Immutable Object + use of E from Lists.asList(leastValue, remainingValuesInOrder) <: @Immutable Object + From complementary bound.: use of E from Lists.asList(leastValue, remainingValuesInOrder) = use of T from explicit(Lists.asList(leastValue, remainingValuesInOrder)) + From complementary bound.: use of E from Lists.asList(leastValue, remainingValuesInOrder) <= use of T from explicit(Lists.asList(leastValue, remainingValuesInOrder)) + inference type: java.util.List <: inference type: java.util.List + inference type: java.util.List -> inference type: java.util.List + From: Constraint between method call type and target type for method call:Lists.asList(leastValue, remainingValuesInOrder) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Ordering.java:[305,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable UsingToStringOrdering + method return type: @Mutable Ordering<@Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Ordering.java:[346,46] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of ConcurrentMap.putIfAbsent. + found : @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Ordering.java:[459,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ByFunctionOrdering constructor + unsatisfiable constraint: F extends @Readonly Object <: @Mutable Object + F extends @Readonly Object = use of F from new ByFunctionOrdering<>(function, this) + From complementary bound.: F extends @Readonly Object <= use of F from new ByFunctionOrdering<>(function, this) + @Mutable Function <: inference type: com.google.common.base.Function + @Mutable Function -> inference type: com.google.common.base.Function + function -> inference type: com.google.common.base.Function + From: Argument constraint + T extends @Readonly Object <: @Mutable Object + capture#0221 extends T extends @Readonly Object <: use of T from new ByFunctionOrdering<>(function, this) + From complementary bound.: capture#0221 extends T extends @Readonly Object <= inference type: ? extends T + @Mutable Function <: inference type: com.google.common.base.Function + @Mutable Function -> inference type: com.google.common.base.Function + function -> inference type: com.google.common.base.Function + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Ordering.java:[463,21] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Ordering.onResultOf + unsatisfiable constraint: T2 extends T extends @Immutable Object <: T extends @Readonly Object + T2 extends T extends @Immutable Object <= ? extends T extends @Readonly Object + @Mutable Function<@Mutable Entry, T2 extends T extends @Immutable Object> <: inference type: com.google.common.base.Function + @Mutable Function<@Mutable Entry, T2 extends T extends @Immutable Object> -> inference type: com.google.common.base.Function + Maps.keyFunction() -> inference type: com.google.common.base.Function + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Ordering.java:[757,43] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Ordering.java:[784,34] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Ordering.java:[793,41] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Cut.java:[187,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Comparable + method return type: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Cut.java:[220,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable BelowAll + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Cut.java:[312,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable AboveAll + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DiscreteDomain.java:[110,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable IntegerDomain + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DiscreteDomain.java:[185,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable LongDomain + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DiscreteDomain.java:[239,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable BigIntegerDomain + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterables.java:[98,23] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableCollection + method return type: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterables.java:[98,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Immutable ImmutableCollection <: @Mutable Iterable + use of T from checkNotNull(iterable) <: @Mutable Iterable + From complementary bound.: use of T from checkNotNull(iterable) -> @Mutable Iterable + From: Constraint between method call type and target type for method call:checkNotNull(iterable) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterables.java:[111,43] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator + method return type: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterables.java:[318,51] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @Mutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterables.java:[342,34] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Iterable" to "@Mutable Collection" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterables.java:[548,34] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@Mutable List> + method return type: @Mutable Iterator<@Mutable List> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterables.java:[575,40] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@Mutable List<@org.checkerframework.checker.nullness.qual.Nullable T extends @Readonly Object>> + method return type: @Mutable Iterator<@Mutable List<@org.checkerframework.checker.nullness.qual.Nullable T extends @Readonly Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterables.java:[593,31] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator + method return type: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterables.java:[1029,14] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ConsumingQueueIterator constructor + unsatisfiable constraint: T extends @Readonly Object <: @Mutable Object + T extends @Readonly Object = use of T from new ConsumingQueueIterator<>((Queue)iterable) + From complementary bound.: T extends @Readonly Object <= use of T from new ConsumingQueueIterator<>((Queue)iterable) + @Mutable Queue <: inference type: java.util.Queue + @Mutable Queue -> inference type: java.util.Queue + (Queue)iterable -> inference type: java.util.Queue + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterables.java:[1083,40] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator + method return type: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FluentIterable.java:[323,55] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter iterable of FluentIterable.from. + found : @Immutable List + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FluentIterable.java:[368,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of Iterables.contains. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FluentIterable.java:[720,21] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Maps.toMap + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + E extends @Readonly Object = use of K from Maps.toMap(getDelegate(), valueFunction) + From complementary bound.: E extends @Readonly Object <= use of K from Maps.toMap(getDelegate(), valueFunction) + @Mutable Iterable <: inference type: java.lang.Iterable + @Mutable Iterable -> inference type: java.lang.Iterable + getDelegate() -> inference type: java.lang.Iterable + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FluentIterable.java:[743,26] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Multimaps.index + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + E extends @Readonly Object = use of V from Multimaps.index(getDelegate(), keyFunction) + From complementary bound.: E extends @Readonly Object <= use of V from Multimaps.index(getDelegate(), keyFunction) + @Mutable Iterable <: inference type: java.lang.Iterable + @Mutable Iterable -> inference type: java.lang.Iterable + getDelegate() -> inference type: java.lang.Iterable + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FluentIterable.java:[843,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter parts of Joiner.join. + found : @Mutable FluentIterable + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/io/MoreFiles.java:[311,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableList<@Mutable Path> + method return type: @Mutable Iterable<@Mutable Path> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/io/MoreFiles.java:[317,27] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableList<@Mutable Path> + method return type: @Mutable Iterable<@Mutable Path> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Serialization.java:[92,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Serialization.java:[183,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[151,36] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable BiEntry @Mutable [] + required: @Immutable BiEntry @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[152,36] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable BiEntry @Mutable [] + required: @Immutable BiEntry @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[174,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[190,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[200,11] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[206,11] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[215,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[216,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly BiEntry + required: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[219,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[220,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly BiEntry + required: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[223,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[224,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[226,35] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly BiEntry + required: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[228,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[228,58] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly BiEntry + required: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[230,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly BiEntry + required: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[232,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[234,35] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly BiEntry + required: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[236,13] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[236,64] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly BiEntry + required: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[238,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[240,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly BiEntry + required: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[242,13] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[242,64] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly BiEntry + required: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[276,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to seekByKey(@org.checkerframework.checker.pico.qual.Readonly java.lang.Object,int) not allowed on the given receiver. + found : @Readonly HashBiMap + required: @PICOLost HashBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[292,22] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to seekByValue(@org.checkerframework.checker.pico.qual.Readonly java.lang.Object,int) not allowed on the given receiver. + found : @Readonly HashBiMap + required: @PICOLost HashBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[298,37] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to seekByKey(@org.checkerframework.checker.pico.qual.Readonly java.lang.Object,int) not allowed on the given receiver. + found : @Readonly HashBiMap + required: @PICOLost HashBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[333,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[334,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[384,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[385,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[388,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[389,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[400,38] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable BiEntry @Mutable [] + required: @Immutable BiEntry @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[401,38] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable BiEntry @Mutable [] + required: @Immutable BiEntry @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[408,14] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to insert(@org.checkerframework.checker.pico.qual.Readonly com.google.common.collect.HashBiMap.BiEntry,@org.checkerframework.checker.pico.qual.Readonly com.google.common.collect.HashBiMap.BiEntry) not allowed on the given receiver. + found : @ReceiverDependentMutable HashBiMap + required: @Mutable HashBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[428,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[429,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[472,11] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable HashBiMap.@ReceiverDependentMutable Itr +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[473,15] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable HashBiMap.@ReceiverDependentMutable Itr +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[474,15] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable HashBiMap.@ReceiverDependentMutable Itr +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[502,21] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of KeySet constructor. + found : @Mutable HashBiMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[523,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[524,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[574,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[575,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[601,9] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable HashBiMap + required: @Mutable HashBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[603,9] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to put(K,V) not allowed on the given receiver. + found : @ReceiverDependentMutable HashBiMap + required: @Mutable HashBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[612,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable BiMap + method return type: @Mutable BiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[612,38] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable HashBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[612,40] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @ReceiverDependentMutable HashBiMap.@Mutable Inverse + required: @ReceiverDependentMutable BiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[634,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to forward() not allowed on the given receiver. + found : @Mutable HashBiMap.@ReceiverDependentMutable Inverse + required: @Mutable HashBiMap.@Mutable Inverse +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[664,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[665,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable BiEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[672,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to forward() not allowed on the given receiver. + found : @Mutable HashBiMap.@ReceiverDependentMutable Inverse + required: @Mutable HashBiMap.@Mutable Inverse +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[710,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to forward() not allowed on the given receiver. + found : @Mutable HashBiMap.@ReceiverDependentMutable Inverse + required: @Mutable HashBiMap.@Mutable Inverse +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[778,13] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for InverseSerializedForm constructor + unsatisfiable constraint: inference type: com.google.common.collect.HashBiMap.InverseSerializedForm <: @Mutable Object + inference type: com.google.common.collect.HashBiMap.InverseSerializedForm -> @Mutable Object + From: Constraint between method call type and target type for method call:new InverseSerializedForm<>(HashBiMap.this) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[789,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable HashBiMap + required: @ReceiverDependentMutable HashBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[803,27] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Serialization.writeMap. + found : @ReceiverDependentMutable HashBiMap + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[811,30] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Serialization.populateMap. + found : @ReceiverDependentMutable HashBiMap + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashBiMap.java:[818,80] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set<@ReceiverDependentMutable Entry> + method return type: @Mutable Set<@Mutable Entry<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Immutable Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/hash/BloomFilter.java:[418,72] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter strategy of BloomFilter.create. + found : @Immutable BloomFilterStrategies + required: @Mutable Strategy +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/hash/BloomFilter.java:[629,69] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter strategy of BloomFilter constructor. + found : @Immutable Strategy + required: @Mutable Strategy +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/MoreObjects.java:[400,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of ToStringHelper.isEmpty. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/MoreObjects.java:[408,36] [[immutability, pico, piconoinit, allcheckers]:array.initializer.type.incompatible] incompatible types in array initializer. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableListMultimap.java:[420,39] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ImmutableListMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableListMultimap.java:[429,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ImmutableListMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableListMultimap.java:[468,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Serialization.writeMultimap. + found : @Immutable ImmutableListMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableListMultimap.java:[492,18] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of Builder.put. + found : @Mutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[118,83] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of TreeMultimap constructor. + found : @PolyMutable Multimap, capture#0227 extends V extends @Readonly Comparable> + required: @Mutable Multimap, ? extends V extends @Readonly Comparable> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[132,10] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to putAll(com.google.common.collect.Multimap) not allowed on the given receiver. + found : @ReceiverDependentMutable TreeMultimap + required: @Mutable AbstractMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[137,36] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map> + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[149,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for TreeSet constructor + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + use of E from new @PolyMutable TreeSet<>(valueComparator) = V extends @Readonly Object + From complementary bound.: use of E from new @PolyMutable TreeSet<>(valueComparator) <= V extends @Readonly Object + inference type: java.util.TreeSet <: @PolyMutable SortedSet + inference type: java.util.TreeSet -> @PolyMutable SortedSet + From: Constraint between method call type and target type for method call:new @PolyMutable TreeSet<>(valueComparator) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[194,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable SortedSet" to "@Mutable NavigableSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[194,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableSet + method return type: @PolyMutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[220,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Serialization.writeMultimap. + found : @ReceiverDependentMutable TreeMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[227,18] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable TreeMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[228,20] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable TreeMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[229,10] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setMap(java.util.Map>) not allowed on the given receiver. + found : @ReceiverDependentMutable TreeMultimap + required: @Mutable AbstractMapBasedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultimap.java:[230,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Serialization.populateMultimap. + found : @ReceiverDependentMutable TreeMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractRangeSet.java:[63,18] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C extends @Mutable Comparable of Range.all. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractRangeSet.java:[83,24] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter view of RangeSet.subRangeSet. + found : @Readonly Range> + required: @Immutable Range> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractRangeSet.java:[94,26] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable RangeSet super @PICOBottom NullType ]>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSequentialIterator.java:[49,80] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.extends.clause] Class with annotation @ReceiverDependentMutable cannot extend @Immutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSequentialIterator.java:[56,68] [[immutability, pico, piconoinit, allcheckers]:super.invocation.invalid] Constructor of type @ReceiverDependentMutable cannot call super() of type @Immutable. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSequentialIterator.java:[79,15] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AbstractSequentialIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/cache/AbstractCache.java:[42,59] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Cache. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/cache/AbstractCache.java:[67,22] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of ImmutableMap. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/cache/AbstractCache.java:[68,8] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Map. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/cache/AbstractCache.java:[68,44] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Maps.newLinkedHashMap + unsatisfiable constraint: K extends @Readonly Object <: @Immutable Object + use of K from Maps.newLinkedHashMap() = K extends @Readonly Object + From complementary bound.: use of K from Maps.newLinkedHashMap() <= K extends @Readonly Object + inference type: java.util.LinkedHashMap <: @Readonly Map + inference type: java.util.LinkedHashMap -> @Readonly Map + From: Constraint between method call type and target type for method call:Maps.newLinkedHashMap() +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/cache/AbstractCache.java:[79,30] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableMap.copyOf + unsatisfiable constraint: K extends @Readonly Object <: @Immutable Object + K extends @Readonly Object <: use of K from ImmutableMap.copyOf(result) + From complementary bound.: K extends @Readonly Object <= inference type: ? extends K + @Mutable Map <: inference type: java.util.Map + @Mutable Map -> inference type: java.util.Map + result -> inference type: java.util.Map + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/cache/AbstractCache.java:[129,23] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of ConcurrentMap. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AbstractFuture.java:[1330,14] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] ; The Checker Framework crashed. Please report the crash. Version: Checker Framework 3.49.5-eisop1-SNAPSHOT, branch pico-move-lazy, 2025-10-29, commit 3261311, dirty=true. + Checker: class org.checkerframework.checker.pico.PICONoInitSubchecker + Visitor: class org.checkerframework.checker.pico.PICONoInitVisitor + Compilation unit: /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AbstractFuture.java + Last visited tree at line 670 column 55: + ListenableFuture futureToPropagateTo = ((SetFuture) localValue).future; + Exception: org.checkerframework.javacutil.BugInCF: Wildcard /*INFERENCE FAILED for:*/ ? extends @Mutable Object is not a type argument of @Mutable ListenableFuture; org.checkerframework.javacutil.BugInCF: Wildcard /*INFERENCE FAILED for:*/ ? extends @Mutable Object is not a type argument of @Mutable ListenableFuture + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.getTypeParameterElement(PropagationTypeAnnotator.java:226) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:132) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedWildcardType.accept(AnnotatedTypeMirror.java:2423) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:158) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedWildcardType.accept(AnnotatedTypeMirror.java:2423) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:224) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scanAndReduce(AnnotatedTypeScanner.java:231) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visitDeclared(AnnotatedTypeScanner.java:277) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitDeclared(PropagationTypeAnnotator.java:112) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitDeclared(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedDeclaredType.accept(AnnotatedTypeMirror.java:1055) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:58) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:20) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.addComputedTypeAnnotations(GenericAnnotatedTypeFactory.java:2090) + at org.checkerframework.framework.type.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:1508) + at org.checkerframework.framework.flow.CFAbstractTransfer.getValueFromFactory(CFAbstractTransfer.java:225) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitFieldAccess(CFAbstractTransfer.java:796) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitFieldAccess(CFAbstractTransfer.java:106) + at org.checkerframework.dataflow.cfg.node.FieldAccessNode.accept(FieldAccessNode.java:93) + at org.checkerframework.dataflow.analysis.AbstractAnalysis.callTransferFunction(AbstractAnalysis.java:396) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.callTransferFunction(ForwardAnalysisImpl.java:402) + at org.checkerframework.framework.flow.CFAbstractAnalysis.callTransferFunction(CFAbstractAnalysis.java:246) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysisBlock(ForwardAnalysisImpl.java:157) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysis(ForwardAnalysisImpl.java:110) + at org.checkerframework.framework.flow.CFAbstractAnalysis.performAnalysis(CFAbstractAnalysis.java:155) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.analyze(GenericAnnotatedTypeFactory.java:1629) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.performFlowAnalysis(GenericAnnotatedTypeFactory.java:1518) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.checkAndPerformFlowAnalysis(GenericAnnotatedTypeFactory.java:2132) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.preProcessClassTree(GenericAnnotatedTypeFactory.java:452) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:631) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:197) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860) + at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60) + at org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:91) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1440) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1355) + at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:193) + at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:854) + at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1394) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1351) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1492) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1408) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176) + at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) + at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) + Caused by: java.lang.Throwable + at org.checkerframework.javacutil.BugInCF.(BugInCF.java:39) + ... 60 more + + Underlying Exception: java.lang.Throwable; java.lang.Throwable + at org.checkerframework.javacutil.BugInCF.(BugInCF.java:39) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.getTypeParameterElement(PropagationTypeAnnotator.java:226) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:132) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedWildcardType.accept(AnnotatedTypeMirror.java:2423) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:158) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedWildcardType.accept(AnnotatedTypeMirror.java:2423) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:224) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scanAndReduce(AnnotatedTypeScanner.java:231) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visitDeclared(AnnotatedTypeScanner.java:277) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitDeclared(PropagationTypeAnnotator.java:112) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitDeclared(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedDeclaredType.accept(AnnotatedTypeMirror.java:1055) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:58) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:20) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.addComputedTypeAnnotations(GenericAnnotatedTypeFactory.java:2090) + at org.checkerframework.framework.type.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:1508) + at org.checkerframework.framework.flow.CFAbstractTransfer.getValueFromFactory(CFAbstractTransfer.java:225) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitFieldAccess(CFAbstractTransfer.java:796) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitFieldAccess(CFAbstractTransfer.java:106) + at org.checkerframework.dataflow.cfg.node.FieldAccessNode.accept(FieldAccessNode.java:93) + at org.checkerframework.dataflow.analysis.AbstractAnalysis.callTransferFunction(AbstractAnalysis.java:396) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.callTransferFunction(ForwardAnalysisImpl.java:402) + at org.checkerframework.framework.flow.CFAbstractAnalysis.callTransferFunction(CFAbstractAnalysis.java:246) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysisBlock(ForwardAnalysisImpl.java:157) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysis(ForwardAnalysisImpl.java:110) + at org.checkerframework.framework.flow.CFAbstractAnalysis.performAnalysis(CFAbstractAnalysis.java:155) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.analyze(GenericAnnotatedTypeFactory.java:1629) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.performFlowAnalysis(GenericAnnotatedTypeFactory.java:1518) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.checkAndPerformFlowAnalysis(GenericAnnotatedTypeFactory.java:2132) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.preProcessClassTree(GenericAnnotatedTypeFactory.java:452) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:631) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:197) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860) + at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60) + at org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:91) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1440) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1355) + at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:193) + at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:854) + at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1394) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1351) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1492) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1408) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176) + at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) + at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) +/Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java:[116,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of ExecutorService.invokeAll. + found : @Immutable ImmutableList<@Mutable Callable> + required: @Mutable Collection> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java:[123,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of ExecutorService.invokeAll. + found : @Immutable ImmutableList<@Mutable Callable> + required: @Mutable Collection> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java:[129,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of ExecutorService.invokeAny. + found : @Immutable ImmutableList<@Mutable Callable> + required: @Mutable Collection> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java:[136,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of ExecutorService.invokeAny. + found : @Immutable ImmutableList<@Mutable Callable> + required: @Mutable Collection> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[449,31] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List<@Mutable List> + method return type: @Mutable List<@Readonly List> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[449,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter lists of CartesianList.create. + found : @Mutable List> + required: @Immutable List> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[546,8] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable List + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[564,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Function + required: @ReceiverDependentMutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[564,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Function <: @ReceiverDependentMutable Function + use of T from checkNotNull(function) <: @ReceiverDependentMutable Function + From complementary bound.: use of T from checkNotNull(function) -> @ReceiverDependentMutable Function + From: Constraint between method call type and target type for method call:checkNotNull(function) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[618,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Function + required: @ReceiverDependentMutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[618,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Function <: @ReceiverDependentMutable Function + use of T from checkNotNull(function) <: @ReceiverDependentMutable Function + From complementary bound.: use of T from checkNotNull(function) -> @ReceiverDependentMutable Function + From: Constraint between method call type and target type for method call:checkNotNull(function) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[629,27] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to apply(F) not allowed on the given receiver. + found : @PICOLost Function + required: @PICOLost Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[712,25] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to subList(int,int) not allowed on the given receiver. + found : @PICOLost List + required: @PICOLost List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[712,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PICOLost List + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[807,22] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable CharSequence + required: @ReceiverDependentMutable CharSequence +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[838,23] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Immutable List" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[914,20] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable List + method return type: @PolyMutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[914,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter list of Lists.reverse. + found : @PolyMutable List + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Lists.java:[1022,24] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/CollectionFuture.java:[53,16] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to add(E) not allowed on the given receiver. + found : @Readonly List<@Mutable Present> + required: @Mutable List<@Mutable Present> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/CollectionFuture.java:[56,18] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly List<@Mutable Present> + required: @Mutable List<@Mutable Present> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/CollectionFuture.java:[99,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List<@org.checkerframework.checker.nullness.qual.Nullable V extends @Mutable Object> + method return type: @Mutable List<@org.checkerframework.checker.nullness.qual.Nullable V extends @Mutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/Throwables.java:[317,39] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List<@Mutable Throwable> + method return type: @Mutable List<@Mutable Throwable> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/Throwables.java:[392,8] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly List<@Immutable StackTraceElement> + method return type: @Mutable List<@Immutable StackTraceElement> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/Throwables.java:[428,84] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter params of Throwables.invokeAccessibleNonThrowingMethod. + found : @Immutable int + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/AbstractValueGraph.java:[155,40] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Map. + found : @Mutable EndpointPair + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/AbstractValueGraph.java:[164,21] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Maps.asMap + unsatisfiable constraint: @Mutable EndpointPair <: @Immutable Object + @Mutable EndpointPair = use of K from Maps.asMap(graph.edges(), edgeToValueFn) + From complementary bound.: @Mutable EndpointPair <= use of K from Maps.asMap(graph.edges(), edgeToValueFn) + @Mutable Set<@Mutable EndpointPair> <: inference type: @org.checkerframework.checker.pico.qual.PolyMutable java.util.Set + @Mutable Set<@Mutable EndpointPair> -> inference type: @org.checkerframework.checker.pico.qual.PolyMutable java.util.Set + graph.edges() -> inference type: @org.checkerframework.checker.pico.qual.PolyMutable java.util.Set + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/AbstractBaseGraph.java:[73,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable EndpointPairIterator + method return type: @Immutable UnmodifiableIterator<@Mutable EndpointPair> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/AbstractBaseGraph.java:[123,77] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set2 of Sets.difference. + found : @Immutable ImmutableSet + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/AbstractBaseGraph.java:[123,93] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromIterator of Iterators.transform. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/MapIteratorCache.java:[123,15] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Mutable MapIteratorCache.@Mutable .@Readonly (@Mutable MapIteratorCache.@Mutable this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/MapIteratorCache.java:[123,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[54,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Multimap + required: @ReceiverDependentMutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[54,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Multimap <: @ReceiverDependentMutable Multimap + use of T from checkNotNull(unfiltered) <: @ReceiverDependentMutable Multimap + From complementary bound.: use of T from checkNotNull(unfiltered) -> @ReceiverDependentMutable Multimap + From: Constraint between method call type and target type for method call:checkNotNull(unfiltered) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[55,36] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Predicate + required: @ReceiverDependentMutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[55,36] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Predicate <: @ReceiverDependentMutable Predicate + use of T from checkNotNull(keyPredicate) <: @ReceiverDependentMutable Predicate + From complementary bound.: use of T from checkNotNull(keyPredicate) -> @ReceiverDependentMutable Predicate + From: Constraint between method call type and target type for method call:checkNotNull(keyPredicate) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[60,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Multimap + method return type: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[65,38] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter keyPredicate of Maps.keyPredicateOnEntries. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[81,12] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[89,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Collection + method return type: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[89,50] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to removeAll(@org.checkerframework.checker.pico.qual.Readonly java.lang.Object) not allowed on the given receiver. + found : @ReceiverDependentMutable Multimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[102,18] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable Set + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[107,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Sets.filter. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[113,27] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Collection + method return type: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[115,13] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for AddRejectingSet constructor + unsatisfiable constraint: V extends @Readonly Object <: @Mutable Object + use of V from new AddRejectingSet<>(key) = V extends @Readonly Object + From complementary bound.: use of V from new AddRejectingSet<>(key) <= V extends @Readonly Object + inference type: com.google.common.collect.FilteredKeyMultimap.AddRejectingSet <: @Mutable Collection + inference type: com.google.common.collect.FilteredKeyMultimap.AddRejectingSet -> @Mutable Collection + From: Constraint between method call type and target type for method call:new AddRejectingSet<>(key) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[142,33] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[182,34] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[220,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of FilteredMultimapValues constructor. + found : @ReceiverDependentMutable FilteredKeyMultimap + required: @Mutable FilteredMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[225,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of Maps.filterKeys. + found : @ReceiverDependentMutable Map> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[225,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter keyPredicate of Maps.filterKeys. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[230,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of Multisets.filter. + found : @ReceiverDependentMutable Multiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredKeyMultimap.java:[230,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter predicate of Multisets.filter. + found : @ReceiverDependentMutable Predicate + required: @Mutable Predicate +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMaker.java:[306,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of ToStringHelper.add. + found : @Immutable String + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMaker.java:[309,46] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of ToStringHelper.add. + found : @Immutable String + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMaker.java:[312,17] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of ToStringHelper.addValue. + found : @Immutable String + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[168,38] [[immutability, pico, piconoinit, allcheckers]:implicit.shallow.immutable] Write an explicit mutable qualifier if wants to exclude the field from the abstract state! Otherwise change the class mutability of this object ! +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[179,46] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Equivalence<@Mutable Object> + required: @Mutable Equivalence<@Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[180,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable InternalEntryHelper, S extends @Mutable Segment, S>> + required: @ReceiverDependentMutable InternalEntryHelper, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[195,35] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Segment, S extends @Mutable Segment, S>> @Mutable [] + required: @Mutable Segment, S extends @Mutable Segment, S>> @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[264,33] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Equivalence<@Readonly Object> + method return type: @Mutable Equivalence<@Mutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[298,106] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter E of Segment. + found : E extends @Readonly InternalEntry + required: @Mutable InternalEntry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[306,43] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter E of MapMakerInternalMap. + found : E extends @Readonly InternalEntry + required: @Mutable InternalEntry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[394,29] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter E of WeakValueReference. + found : E extends @Readonly InternalEntry + required: @Mutable InternalEntry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[404,82] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter E of InternalEntry. + found : E extends @Mutable InternalEntry + required: @Readonly InternalEntry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[405,31] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter E of WeakValueReference. + found : E extends @Readonly InternalEntry + required: @Mutable InternalEntry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[406,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable WeakValueReference>> + method return type: @Mutable WeakValueReference> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[426,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable StrongKeyStrongValueEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[443,27] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Helper. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[500,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable WeakValueReference> + required: @ReceiverDependentMutable WeakValueReference> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[518,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable StrongKeyWeakValueEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[518,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable WeakValueReferenceImpl> + required: @ReceiverDependentMutable WeakValueReference> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[518,28] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for WeakValueReferenceImpl constructor + unsatisfiable constraint: @ReceiverDependentMutable StrongKeyWeakValueEntry <: @Mutable StrongKeyWeakValueEntry + @Mutable StrongKeyWeakValueEntry = use of E from new WeakValueReferenceImpl<>(queueForValues, value, this) + From complementary bound.: @Mutable StrongKeyWeakValueEntry <= use of E from new WeakValueReferenceImpl<>(queueForValues, value, this) + @ReceiverDependentMutable StrongKeyWeakValueEntry <: inference type: com.google.common.collect.MapMakerInternalMap.InternalEntry + @ReceiverDependentMutable StrongKeyWeakValueEntry <: use of E from new WeakValueReferenceImpl<>(queueForValues, value, this) + From complementary bound.: @ReceiverDependentMutable StrongKeyWeakValueEntry -> use of E from new WeakValueReferenceImpl<>(queueForValues, value, this) + this -> use of E from new WeakValueReferenceImpl<>(queueForValues, value, this) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[531,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable WeakValueReference> + method return type: @Mutable WeakValueReference> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[541,27] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Helper. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[729,24] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Helper. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[871,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable WeakValueReference> + required: @ReceiverDependentMutable WeakValueReference> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[900,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable WeakKeyWeakValueEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[900,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable WeakValueReferenceImpl> + required: @ReceiverDependentMutable WeakValueReference> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[900,28] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for WeakValueReferenceImpl constructor + unsatisfiable constraint: @ReceiverDependentMutable WeakKeyWeakValueEntry <: @Mutable WeakKeyWeakValueEntry + @Mutable WeakKeyWeakValueEntry = use of E from new WeakValueReferenceImpl<>(queueForValues, value, this) + From complementary bound.: @Mutable WeakKeyWeakValueEntry <= use of E from new WeakValueReferenceImpl<>(queueForValues, value, this) + @ReceiverDependentMutable WeakKeyWeakValueEntry <: inference type: com.google.common.collect.MapMakerInternalMap.InternalEntry + @ReceiverDependentMutable WeakKeyWeakValueEntry <: use of E from new WeakValueReferenceImpl<>(queueForValues, value, this) + From complementary bound.: @ReceiverDependentMutable WeakKeyWeakValueEntry -> use of E from new WeakValueReferenceImpl<>(queueForValues, value, this) + this -> use of E from new WeakValueReferenceImpl<>(queueForValues, value, this) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[906,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable WeakValueReference> + method return type: @Mutable WeakValueReference> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1045,34] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of WeakValueReference. + found : @Mutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1045,50] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter E of WeakValueReference. + found : @Mutable DummyInternalEntry + required: @Mutable InternalEntry<@Mutable Object, @Mutable Object, @Mutable DummyInternalEntry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1140,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of InternalEntryHelper.newSegment. + found : @ReceiverDependentMutable MapMakerInternalMap, S extends @Mutable Segment, S>> + required: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1222,47] [[immutability, pico, piconoinit, allcheckers]:implicit.shallow.immutable] Write an explicit mutable qualifier if wants to exclude the field from the abstract state! Otherwise change the class mutability of this object ! +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1231,24] [[immutability, pico, piconoinit, allcheckers]:implicit.shallow.immutable] Write an explicit mutable qualifier if wants to exclude the field from the abstract state! Otherwise change the class mutability of this object ! +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1234,17] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>> + required: @ReceiverDependentMutable MapMakerInternalMap, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1269,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1272,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1274,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1528,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1531,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1540,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1548,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1552,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1580,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1624,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1625,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1648,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1652,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1658,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1695,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1699,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1704,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1742,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1746,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1783,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1787,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1809,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1810,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1841,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1857,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1861,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1889,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1893,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1949,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1953,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Segment, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[1965,42] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of InternalEntry. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2027,22] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Segment. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2027,54] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of StrongKeyStrongValueEntry. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2030,16] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of MapMakerInternalMap. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2030,48] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of StrongKeyStrongValueEntry. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2039,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable StrongKeyStrongValueSegment + method return type: @Mutable StrongKeyStrongValueSegment +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2044,37] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of StrongKeyStrongValueEntry. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2044,72] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of InternalEntry. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2128,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable StrongKeyDummyValueSegment + method return type: @Mutable StrongKeyDummyValueSegment +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2142,51] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable ReferenceQueue + required: @ReceiverDependentMutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2154,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable WeakKeyStrongValueSegment + method return type: @Mutable WeakKeyStrongValueSegment +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2159,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable ReferenceQueue + method return type: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2170,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter keyReferenceQueue of Segment.drainKeyReferenceQueue. + found : @ReceiverDependentMutable ReferenceQueue + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2175,26] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter referenceQueue of Segment.clearReferenceQueue. + found : @ReceiverDependentMutable ReferenceQueue + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2183,51] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable ReferenceQueue + required: @ReceiverDependentMutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2184,53] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable ReferenceQueue + required: @ReceiverDependentMutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2195,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable WeakKeyWeakValueSegment + method return type: @Mutable WeakKeyWeakValueSegment +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2200,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable ReferenceQueue + method return type: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2205,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable ReferenceQueue + method return type: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2223,42] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter queue of WeakValueReferenceImpl constructor. + found : @ReceiverDependentMutable ReferenceQueue + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2241,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter keyReferenceQueue of Segment.drainKeyReferenceQueue. + found : @ReceiverDependentMutable ReferenceQueue + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2242,31] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter valueReferenceQueue of Segment.drainValueReferenceQueue. + found : @ReceiverDependentMutable ReferenceQueue + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2247,26] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter referenceQueue of Segment.clearReferenceQueue. + found : @ReceiverDependentMutable ReferenceQueue + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2254,22] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Segment. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2254,55] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of WeakKeyDummyValueEntry. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2255,51] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable ReferenceQueue + required: @ReceiverDependentMutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2258,28] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of MapMakerInternalMap. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2258,61] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of WeakKeyDummyValueEntry. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2266,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable WeakKeyDummyValueSegment + method return type: @Mutable WeakKeyDummyValueSegment +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2271,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable ReferenceQueue + method return type: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2276,34] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of WeakKeyDummyValueEntry. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2276,66] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of InternalEntry. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2282,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter keyReferenceQueue of Segment.drainKeyReferenceQueue. + found : @ReceiverDependentMutable ReferenceQueue + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2287,26] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter referenceQueue of Segment.clearReferenceQueue. + found : @ReceiverDependentMutable ReferenceQueue + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2323,57] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Equivalence<@Mutable Object> + method return type: @Mutable Equivalence<@Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2441,20] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of MapMakerInternalMap.hash. + found : K extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2450,20] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of MapMakerInternalMap.hash. + found : K extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2489,20] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of MapMakerInternalMap.hash. + found : K extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2498,20] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of MapMakerInternalMap.hash. + found : K extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2514,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Set<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> + method return type: @Mutable Set<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2514,39] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable MapMakerInternalMap, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2514,41] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @ReceiverDependentMutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@Mutable KeySet + required: @ReceiverDependentMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2522,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Collection + method return type: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2522,39] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable MapMakerInternalMap, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2522,41] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @ReceiverDependentMutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@Mutable Values + required: @ReceiverDependentMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2530,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Set<@Mutable Entry<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Readonly Object>> + method return type: @Mutable Set<@Mutable Entry<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Readonly Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2530,41] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable MapMakerInternalMap, S extends @Mutable Segment, S>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2530,43] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @ReceiverDependentMutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@Mutable EntrySet + required: @ReceiverDependentMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2541,38] [[immutability, pico, piconoinit, allcheckers]:implicit.shallow.immutable] Write an explicit mutable qualifier if wants to exclude the field from the abstract state! Otherwise change the class mutability of this object ! +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2556,19] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2567,23] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2567,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Segment, S extends @Mutable Segment, S>> + required: @ReceiverDependentMutable Segment>, S extends @Mutable Segment, S extends @Mutable Segment, S>>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2567,50] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2569,23] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2570,25] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2581,23] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2581,75] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2593,23] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2593,56] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2611,23] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2611,25] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@Mutable WriteThroughEntry + required: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable WriteThroughEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2631,19] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2633,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable WriteThroughEntry + method return type: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@Mutable WriteThroughEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2639,57] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of MapMakerInternalMap.remove. + found : K extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2640,19] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable HashIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2705,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable WriteThroughEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2789,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter c of MapMakerInternalMap.toArrayList. + found : @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable Values + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2789,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @Mutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2794,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter c of MapMakerInternalMap.toArrayList. + found : @Mutable MapMakerInternalMap, S extends @Mutable Segment, S>>.@ReceiverDependentMutable Values + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2817,41] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of MapMakerInternalMap.get. + found : @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2829,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of MapMakerInternalMap.remove. + found : @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2829,75] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of MapMakerInternalMap.remove. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2854,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter c of MapMakerInternalMap.toArrayList. + found : @ReceiverDependentMutable SafeToArraySet + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2854,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @Mutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2859,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter c of MapMakerInternalMap.toArrayList. + found : @ReceiverDependentMutable SafeToArraySet + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2878,8] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter keyEquivalence of SerializationProxy constructor. + found : @Mutable Equivalence<@Readonly Object> + required: @Mutable Equivalence<@Mutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2881,8] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of SerializationProxy constructor. + found : @ReceiverDependentMutable MapMakerInternalMap, S extends @Mutable Segment, S>> + required: @Mutable ConcurrentMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2895,30] [[immutability, pico, piconoinit, allcheckers]:implicit.shallow.immutable] Write an explicit mutable qualifier if wants to exclude the field from the abstract state! Otherwise change the class mutability of this object ! +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2896,30] [[immutability, pico, piconoinit, allcheckers]:implicit.shallow.immutable] Write an explicit mutable qualifier if wants to exclude the field from the abstract state! Otherwise change the class mutability of this object ! +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2913,22] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable ConcurrentMap + required: @ReceiverDependentMutable ConcurrentMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2918,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable ConcurrentMap + method return type: @Mutable ConcurrentMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2944,16] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2949,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to put(K,V) not allowed on the given receiver. + found : @ReceiverDependentMutable ConcurrentMap + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2958,89] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of AbstractSerializationProxy. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2967,22] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of ConcurrentMap. + found : K extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MapMakerInternalMap.java:[2980,33] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for MapMaker.makeMap + unsatisfiable constraint: K extends @Readonly Object <: @Immutable Object + use of K from mapMaker.makeMap() = K extends @Readonly Object + From complementary bound.: use of K from mapMaker.makeMap() <= K extends @Readonly Object + inference type: java.util.concurrent.ConcurrentMap <: @Mutable ConcurrentMap + inference type: java.util.concurrent.ConcurrentMap -> @Mutable ConcurrentMap + From: Constraint between method call type and target type for method call:mapMaker.makeMap() +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingTable.java:[54,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set<@Mutable Cell> + method return type: @ReceiverDependentMutable Set<@Mutable Cell> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/reflect/TypeToInstanceMap.java:[46,59] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Map. + found : @Mutable TypeToken + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TopKSelector.java:[286,39] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/eventbus/EventBus.java:[276,53] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of ToStringHelper.addValue. + found : @Immutable String + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SortedLists.java:[226,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for SortedLists.binarySearch + unsatisfiable constraint: K extends @Mutable Comparable <: @Immutable Object + K extends @Mutable Comparable = use of K from binarySearch(list, keyFunction, key, Ordering.natural(), presentBehavior, absentBehavior) + From complementary bound.: K extends @Mutable Comparable <= use of K from binarySearch(list, keyFunction, key, Ordering.natural(), presentBehavior, absentBehavior) + @Mutable Function> <: inference type: com.google.common.base.Function + @Mutable Function> -> inference type: com.google.common.base.Function + keyFunction -> inference type: com.google.common.base.Function + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SortedLists.java:[244,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for SortedLists.binarySearch + unsatisfiable constraint: K extends @Immutable Object <: @Mutable Object + K extends @Immutable Object <: use of E from binarySearch(Lists.transform(list, keyFunction), key, keyComparator, presentBehavior, absentBehavior) + From complementary bound.: use of T from Lists.transform(list, keyFunction) <: use of E from binarySearch(Lists.transform(list, keyFunction), key, keyComparator, presentBehavior, absentBehavior) + From complementary bound.: use of T from Lists.transform(list, keyFunction) <= inference type: ? extends E + inference type: java.util.List <: inference type: java.util.List + inference type: java.util.List -> inference type: java.util.List + From: Constraint between method call type and target type for method call:Lists.transform(list, keyFunction) + K extends @Immutable Object <: @Mutable Object + use of T from Lists.transform(list, keyFunction) <: @Mutable Object + From complementary bound.: use of T from Lists.transform(list, keyFunction) <: use of E from binarySearch(Lists.transform(list, keyFunction), key, keyComparator, presentBehavior, absentBehavior) + From complementary bound.: use of T from Lists.transform(list, keyFunction) <= inference type: ? extends E + inference type: java.util.List <: inference type: java.util.List + inference type: java.util.List -> inference type: java.util.List + From: Constraint between method call type and target type for method call:Lists.transform(list, keyFunction) +[WARNING] ; The Checker Framework crashed. Please report the crash. Version: Checker Framework 3.49.5-eisop1-SNAPSHOT, branch pico-move-lazy, 2025-10-29, commit 3261311, dirty=true. + Checker: class org.checkerframework.checker.pico.PICONoInitSubchecker + Visitor: class org.checkerframework.checker.pico.PICONoInitVisitor + Compilation unit: /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableRangeSet.java + Last visited tree at line 773 column 21: + return addAll(ranges.asRanges()); + Exception: org.checkerframework.javacutil.BugInCF: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture; org.checkerframework.javacutil.BugInCF: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.getTypeParameterElement(PropagationTypeAnnotator.java:226) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:132) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedWildcardType.accept(AnnotatedTypeMirror.java:2423) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:58) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:20) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.addDefaultAnnotations(GenericAnnotatedTypeFactory.java:1987) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:872) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:32) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:723) + at org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor.visit(AbstractAtmComboVisitor.java:34) + at org.checkerframework.framework.type.AsSuperVisitor.visit(AsSuperVisitor.java:109) + at org.checkerframework.framework.type.AsSuperVisitor.asSuper(AsSuperVisitor.java:90) + at org.checkerframework.framework.util.AnnotatedTypes.asSuper(AnnotatedTypes.java:120) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:518) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visitTypevar_Typevar(EquivalentAtmComboScanner.java:188) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:589) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:669) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.access$200(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism.resolve(AbstractQualifierPolymorphism.java:212) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUsePreSubstitution(GenericAnnotatedTypeFactory.java:2342) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2634) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2545) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUse(GenericAnnotatedTypeFactory.java:2331) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2505) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:419) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:82) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1813) + at jdk.compiler/com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:81) + at org.checkerframework.framework.type.TypeFromTree.fromExpression(TypeFromTree.java:43) + at org.checkerframework.framework.type.AnnotatedTypeFactory.fromExpression(AnnotatedTypeFactory.java:1861) + at org.checkerframework.framework.type.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:1501) + at org.checkerframework.framework.flow.CFAbstractTransfer.getValueFromFactory(CFAbstractTransfer.java:225) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:1152) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:106) + at org.checkerframework.dataflow.cfg.node.MethodInvocationNode.accept(MethodInvocationNode.java:156) + at org.checkerframework.dataflow.analysis.AbstractAnalysis.callTransferFunction(AbstractAnalysis.java:396) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.callTransferFunction(ForwardAnalysisImpl.java:402) + at org.checkerframework.framework.flow.CFAbstractAnalysis.callTransferFunction(CFAbstractAnalysis.java:246) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysisBlock(ForwardAnalysisImpl.java:157) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysis(ForwardAnalysisImpl.java:110) + at org.checkerframework.framework.flow.CFAbstractAnalysis.performAnalysis(CFAbstractAnalysis.java:155) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.analyze(GenericAnnotatedTypeFactory.java:1629) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.performFlowAnalysis(GenericAnnotatedTypeFactory.java:1518) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.checkAndPerformFlowAnalysis(GenericAnnotatedTypeFactory.java:2132) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.preProcessClassTree(GenericAnnotatedTypeFactory.java:452) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:631) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:197) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860) + at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60) + at org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:91) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1440) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1355) + at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:193) + at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:854) + at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1394) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1351) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176) + at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) + at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) + Caused by: java.lang.Throwable + at org.checkerframework.javacutil.BugInCF.(BugInCF.java:39) + ... 82 more + + Underlying Exception: java.lang.Throwable; java.lang.Throwable + at org.checkerframework.javacutil.BugInCF.(BugInCF.java:39) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.getTypeParameterElement(PropagationTypeAnnotator.java:226) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:132) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedWildcardType.accept(AnnotatedTypeMirror.java:2423) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:58) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:20) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.addDefaultAnnotations(GenericAnnotatedTypeFactory.java:1987) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:872) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:32) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:723) + at org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor.visit(AbstractAtmComboVisitor.java:34) + at org.checkerframework.framework.type.AsSuperVisitor.visit(AsSuperVisitor.java:109) + at org.checkerframework.framework.type.AsSuperVisitor.asSuper(AsSuperVisitor.java:90) + at org.checkerframework.framework.util.AnnotatedTypes.asSuper(AnnotatedTypes.java:120) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:518) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visitTypevar_Typevar(EquivalentAtmComboScanner.java:188) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:589) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:669) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.access$200(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism.resolve(AbstractQualifierPolymorphism.java:212) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUsePreSubstitution(GenericAnnotatedTypeFactory.java:2342) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2634) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2545) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUse(GenericAnnotatedTypeFactory.java:2331) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2505) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:419) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:82) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1813) + at jdk.compiler/com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:81) + at org.checkerframework.framework.type.TypeFromTree.fromExpression(TypeFromTree.java:43) + at org.checkerframework.framework.type.AnnotatedTypeFactory.fromExpression(AnnotatedTypeFactory.java:1861) + at org.checkerframework.framework.type.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:1501) + at org.checkerframework.framework.flow.CFAbstractTransfer.getValueFromFactory(CFAbstractTransfer.java:225) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:1152) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:106) + at org.checkerframework.dataflow.cfg.node.MethodInvocationNode.accept(MethodInvocationNode.java:156) + at org.checkerframework.dataflow.analysis.AbstractAnalysis.callTransferFunction(AbstractAnalysis.java:396) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.callTransferFunction(ForwardAnalysisImpl.java:402) + at org.checkerframework.framework.flow.CFAbstractAnalysis.callTransferFunction(CFAbstractAnalysis.java:246) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysisBlock(ForwardAnalysisImpl.java:157) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysis(ForwardAnalysisImpl.java:110) + at org.checkerframework.framework.flow.CFAbstractAnalysis.performAnalysis(CFAbstractAnalysis.java:155) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.analyze(GenericAnnotatedTypeFactory.java:1629) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.performFlowAnalysis(GenericAnnotatedTypeFactory.java:1518) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.checkAndPerformFlowAnalysis(GenericAnnotatedTypeFactory.java:2132) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.preProcessClassTree(GenericAnnotatedTypeFactory.java:452) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:631) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:197) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860) + at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60) + at org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:91) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1440) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1355) + at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:193) + at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:854) + at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1394) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1351) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176) + at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) + at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) +/Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[589,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter comparator of ImmutableSortedSet.unsafeCompare. + found : @Immutable Comparator + required: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[598,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of Comparator.compare. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[598,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg1 of Comparator.compare. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[604,22] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Comparator + required: @Immutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[615,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Comparator + method return type: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[710,65] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter iterator of Iterators.getNext. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[717,64] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter iterator of Iterators.getNext. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[724,37] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter iterable of Iterables.getFirst. + found : @Immutable ImmutableSortedSet + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[732,37] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter iterable of Iterables.getFirst. + found : @Immutable ImmutableSortedSet + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[737,26] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[742,36] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[791,29] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ImmutableSortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[792,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ImmutableSortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[812,37] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[821,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Comparator + method return type: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedSet.java:[863,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter comparator of SerializedForm constructor. + found : @Immutable Comparator + required: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[145,33] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[154,37] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[171,35] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Collections.binarySearch + unsatisfiable constraint: E extends @Readonly Object <: @Mutable Object + use of T from Collections.binarySearch(elements, key, unsafeComparator()) <: @Mutable Object + From complementary bound.: @Mutable Object <= inference type: ? super T + @Mutable Comparator<@Mutable Object> <: inference type: java.util.Comparator + @Mutable Comparator<@Mutable Object> -> inference type: java.util.Comparator + unsafeComparator() -> inference type: java.util.Comparator + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[201,42] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter comparator of SortedIterables.hasSameComparator. + found : @Immutable Comparator + required: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[206,40] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[307,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Immutable Comparator" to "@Mutable Comparator<@Mutable Object>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[315,54] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter comparator of RegularImmutableSortedSet constructor. + found : @Immutable Comparator + required: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[317,22] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter comparator of ImmutableSortedSet.emptySet. + found : @Immutable Comparator + required: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[328,41] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Collections.binarySearch + unsatisfiable constraint: E extends @Readonly Object <: @Mutable Object + use of T from Collections.binarySearch(elements, target, unsafeComparator()) <: @Mutable Object + From complementary bound.: @Mutable Object <= inference type: ? super T + @Mutable Comparator<@Mutable Object> <: inference type: java.util.Comparator + @Mutable Comparator<@Mutable Object> -> inference type: java.util.Comparator + unsafeComparator() -> inference type: java.util.Comparator + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[344,19] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter comparator of ImmutableSortedSet.emptySet. + found : @Readonly Comparator + required: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedSet.java:[345,63] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter comparator of RegularImmutableSortedSet constructor. + found : @Readonly Comparator + required: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/primitives/Primitives.java:[59,59] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable Map<@Immutable Class, @Immutable Class> + required: @Mutable Map<@Immutable Class, @Immutable Class> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/primitives/Primitives.java:[60,59] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable Map<@Immutable Class, @Immutable Class> + required: @Mutable Map<@Immutable Class, @Immutable Class> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SparseImmutableTable.java:[83,26] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SparseImmutableTable.java:[84,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SparseImmutableTable.java:[104,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of ImmutableMap.copyOf. + found : @Immutable ImmutableMap> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SparseImmutableTable.java:[111,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of ImmutableMap.copyOf. + found : @Immutable ImmutableMap> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SparseImmutableTable.java:[146,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter cellRowIndices of SerializedForm.create. + found : @Immutable int @Immutable [] + required: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableTable.java:[159,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of ImmutableSet.copyOf. + found : @Immutable ImmutableList + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableTable.java:[163,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of ImmutableSet.copyOf. + found : @Immutable ImmutableList + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[75,43] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for TableCollectors.toImmutableTable + unsatisfiable constraint: T extends @Readonly Object <: @Mutable Object + T extends @Readonly Object = use of T from TableCollectors.toImmutableTable(rowFunction, columnFunction, valueFunction) + From complementary bound.: use of captured T from TableCollectors.toImmutableTable(rowFunction, columnFunction, valueFunction) = T extends @Readonly Object + From complementary bound.: use of captured T from TableCollectors.toImmutableTable(rowFunction, columnFunction, valueFunction) <= T extends @Readonly Object + inference type: java.util.stream.Collector <: @Mutable Collector> + inference type: java.util.stream.Collector -> @Mutable Collector> + From: Captured constraint from method call: TableCollectors.toImmutableTable(rowFunction, columnFunction, valueFunction) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[95,43] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for TableCollectors.toImmutableTable + unsatisfiable constraint: T extends @Readonly Object <: @Mutable Object + T extends @Readonly Object = use of T from TableCollectors.toImmutableTable(rowFunction, columnFunction, valueFunction, mergeFunction) + From complementary bound.: use of captured T from TableCollectors.toImmutableTable(rowFunction, columnFunction, valueFunction, mergeFunction) = T extends @Readonly Object + From complementary bound.: use of captured T from TableCollectors.toImmutableTable(rowFunction, columnFunction, valueFunction, mergeFunction) <= T extends @Readonly Object + inference type: java.util.stream.Collector <: @Mutable Collector> + inference type: java.util.stream.Collector -> @Mutable Collector> + From: Captured constraint from method call: TableCollectors.toImmutableTable(rowFunction, columnFunction, valueFunction, mergeFunction) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[111,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for SingletonImmutableTable constructor + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object <: use of V from new SingletonImmutableTable<>(rowKey, columnKey, value) + From complementary bound.: V extends @Readonly Object -> use of V from new SingletonImmutableTable<>(rowKey, columnKey, value) + value -> use of V from new SingletonImmutableTable<>(rowKey, columnKey, value) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[160,31] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Cell + method return type: @Mutable Cell +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[293,17] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for SingletonImmutableTable constructor + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object = use of V from new SingletonImmutableTable<>(Iterables.getOnlyElement(cells)) + From complementary bound.: V extends @Readonly Object <= use of V from new SingletonImmutableTable<>(Iterables.getOnlyElement(cells)) + @Mutable Cell <: inference type: com.google.common.collect.Table.Cell + use of T from Iterables.getOnlyElement(cells) <: inference type: com.google.common.collect.Table.Cell + From complementary bound.: use of T from Iterables.getOnlyElement(cells) -> inference type: com.google.common.collect.Table.Cell + From: Constraint between method call type and target type for method call:Iterables.getOnlyElement(cells) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[473,21] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Mutable Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[474,24] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Mutable Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[475,24] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Mutable Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[476,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[477,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[495,17] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableTable.of + unsatisfiable constraint: @Mutable Object <: @Immutable Object + @Mutable Object <: use of R from of(rowKeys[0], columnKeys[0], cellValues[0]) + From complementary bound.: @Mutable Object -> use of R from of(rowKeys[0], columnKeys[0], cellValues[0]) + rowKeys[0] -> use of R from of(rowKeys[0], columnKeys[0], cellValues[0]) + From: Argument constraint + @Mutable Object <: @Immutable Object + @Mutable Object <: use of C from of(rowKeys[0], columnKeys[0], cellValues[0]) + From complementary bound.: @Mutable Object -> use of C from of(rowKeys[0], columnKeys[0], cellValues[0]) + columnKeys[0] -> use of C from of(rowKeys[0], columnKeys[0], cellValues[0]) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[501,18] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableTable.cellOf + unsatisfiable constraint: @Mutable Object <: @Immutable Object + @Mutable Object <: use of R from cellOf(rowKeys[cellRowIndices[i]], columnKeys[cellColumnIndices[i]], cellValues[i]) + From complementary bound.: @Mutable Object -> use of R from cellOf(rowKeys[cellRowIndices[i]], columnKeys[cellColumnIndices[i]], cellValues[i]) + rowKeys[cellRowIndices[i]] -> use of R from cellOf(rowKeys[cellRowIndices[i]], columnKeys[cellColumnIndices[i]], cellValues[i]) + From: Argument constraint + @Mutable Object <: @Immutable Object + @Mutable Object <: use of C from cellOf(rowKeys[cellRowIndices[i]], columnKeys[cellColumnIndices[i]], cellValues[i]) + From complementary bound.: @Mutable Object -> use of C from cellOf(rowKeys[cellRowIndices[i]], columnKeys[cellColumnIndices[i]], cellValues[i]) + columnKeys[cellColumnIndices[i]] -> use of C from cellOf(rowKeys[cellRowIndices[i]], columnKeys[cellColumnIndices[i]], cellValues[i]) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[503,55] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for RegularImmutableTable.forOrderedComponents + unsatisfiable constraint: @Mutable Object <: @Immutable Object + use of E from ImmutableSet.copyOf(rowKeys) = use of R from RegularImmutableTable.forOrderedComponents(cellListBuilder.build(), ImmutableSet.copyOf(rowKeys), ImmutableSet.copyOf(columnKeys)) + From complementary bound.: use of E from ImmutableSet.copyOf(rowKeys) <= use of R from RegularImmutableTable.forOrderedComponents(cellListBuilder.build(), ImmutableSet.copyOf(rowKeys), ImmutableSet.copyOf(columnKeys)) + inference type: com.google.common.collect.ImmutableSet <: inference type: com.google.common.collect.ImmutableSet + inference type: com.google.common.collect.ImmutableSet -> inference type: com.google.common.collect.ImmutableSet + From: Constraint between method call type and target type for method call:ImmutableSet.copyOf(rowKeys) + @Mutable Object <: @Immutable Object + use of E from ImmutableSet.copyOf(columnKeys) = use of C from RegularImmutableTable.forOrderedComponents(cellListBuilder.build(), ImmutableSet.copyOf(rowKeys), ImmutableSet.copyOf(columnKeys)) + From complementary bound.: use of E from ImmutableSet.copyOf(columnKeys) <= use of C from RegularImmutableTable.forOrderedComponents(cellListBuilder.build(), ImmutableSet.copyOf(rowKeys), ImmutableSet.copyOf(columnKeys)) + inference type: com.google.common.collect.ImmutableSet <: inference type: com.google.common.collect.ImmutableSet + inference type: com.google.common.collect.ImmutableSet -> inference type: com.google.common.collect.ImmutableSet + From: Constraint between method call type and target type for method call:ImmutableSet.copyOf(columnKeys) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableTable.java:[511,31] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable SerializedForm + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractTable.java:[152,29] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Cell" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractTable.java:[164,29] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Cell" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[175,12] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : V extends @Readonly Object @Mutable [] @Mutable [] + required: V extends @Readonly Object @ReceiverDependentMutable [] @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[193,12] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : V extends @Readonly Object @Mutable [] @Mutable [] + required: V extends @Readonly Object @ReceiverDependentMutable [] @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[210,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSet + method return type: @Mutable Set<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[504,16] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to putAll(com.google.common.collect.Table) not allowed on the given receiver. + found : @ReceiverDependentMutable ArrayTable + required: @Mutable AbstractTable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[566,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Set<@Mutable Cell> + method return type: @Mutable Set<@Mutable Cell> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[631,21] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Map + method return type: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[674,44] [[immutability, pico, piconoinit, allcheckers]:implicit.shallow.immutable] Write an explicit mutable qualifier if wants to exclude the field from the abstract state! Otherwise change the class mutability of this object ! +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[679,37] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable ArrayTable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[726,21] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Map + method return type: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[774,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Map> + method return type: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[774,34] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable ArrayTable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[774,36] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @ReceiverDependentMutable ArrayTable.@Mutable RowMap + required: @Mutable ArrayTable.@ReceiverDependentMutable RowMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[817,23] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Collection + method return type: @Mutable Collection<@org.checkerframework.checker.nullness.qual.Nullable V extends @Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayTable.java:[822,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Iterator<@org.checkerframework.checker.nullness.qual.Nullable V extends @Readonly Object> + method return type: @ReceiverDependentMutable Iterator<@org.checkerframework.checker.nullness.qual.Nullable V extends @Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[82,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AbstractMapBasedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[102,87] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@ReceiverDependentMutable Entry> + required: @Readonly Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[131,87] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@ReceiverDependentMutable Entry> + required: @Readonly Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[186,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[187,9] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AbstractMapBasedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[221,57] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@Mutable Entry> + required: @ReceiverDependentMutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[233,21] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable AbstractMapBasedMultiset.@ReceiverDependentMutable MapBasedMultisetIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[233,41] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Entry + required: @ReceiverDependentMutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[233,41] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @ReceiverDependentMutable Iterator<@Mutable Entry> + required: @Mutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[234,24] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable AbstractMapBasedMultiset.@ReceiverDependentMutable MapBasedMultisetIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[236,21] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable AbstractMapBasedMultiset.@ReceiverDependentMutable MapBasedMultisetIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[237,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable AbstractMapBasedMultiset.@ReceiverDependentMutable MapBasedMultisetIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[257,28] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove() not allowed on the given receiver. + found : @ReceiverDependentMutable Iterator<@Mutable Entry> + required: @Mutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java:[260,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable AbstractMapBasedMultiset.@ReceiverDependentMutable MapBasedMultisetIterator +[WARNING] ; The Checker Framework crashed. Please report the crash. Version: Checker Framework 3.49.5-eisop1-SNAPSHOT, branch pico-move-lazy, 2025-10-29, commit 3261311, dirty=true. + Checker: class org.checkerframework.checker.pico.PICONoInitSubchecker + Visitor: class org.checkerframework.checker.pico.PICONoInitVisitor + Compilation unit: /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeMap.java + Last visited tree at line 432 column 16: + if (!rangeMap.asMapOfRanges().isEmpty()) { + Exception: org.checkerframework.javacutil.BugInCF: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture; org.checkerframework.javacutil.BugInCF: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.getTypeParameterElement(PropagationTypeAnnotator.java:226) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:132) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedWildcardType.accept(AnnotatedTypeMirror.java:2423) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:58) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:20) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.addDefaultAnnotations(GenericAnnotatedTypeFactory.java:1987) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:872) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:32) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:723) + at org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor.visit(AbstractAtmComboVisitor.java:34) + at org.checkerframework.framework.type.AsSuperVisitor.visit(AsSuperVisitor.java:109) + at org.checkerframework.framework.type.AsSuperVisitor.asSuper(AsSuperVisitor.java:90) + at org.checkerframework.framework.util.AnnotatedTypes.asSuper(AnnotatedTypes.java:120) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:518) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visitTypevar_Typevar(EquivalentAtmComboScanner.java:188) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:589) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:669) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.access$200(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism.resolve(AbstractQualifierPolymorphism.java:212) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUsePreSubstitution(GenericAnnotatedTypeFactory.java:2342) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2634) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2545) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUse(GenericAnnotatedTypeFactory.java:2331) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2505) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:419) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:82) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1813) + at jdk.compiler/com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:81) + at org.checkerframework.framework.type.TypeFromTree.fromExpression(TypeFromTree.java:43) + at org.checkerframework.framework.type.AnnotatedTypeFactory.fromExpression(AnnotatedTypeFactory.java:1861) + at org.checkerframework.framework.type.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:1501) + at org.checkerframework.framework.flow.CFAbstractTransfer.getValueFromFactory(CFAbstractTransfer.java:225) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:1152) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:106) + at org.checkerframework.dataflow.cfg.node.MethodInvocationNode.accept(MethodInvocationNode.java:156) + at org.checkerframework.dataflow.analysis.AbstractAnalysis.callTransferFunction(AbstractAnalysis.java:396) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.callTransferFunction(ForwardAnalysisImpl.java:402) + at org.checkerframework.framework.flow.CFAbstractAnalysis.callTransferFunction(CFAbstractAnalysis.java:246) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysisBlock(ForwardAnalysisImpl.java:157) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysis(ForwardAnalysisImpl.java:110) + at org.checkerframework.framework.flow.CFAbstractAnalysis.performAnalysis(CFAbstractAnalysis.java:155) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.analyze(GenericAnnotatedTypeFactory.java:1629) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.performFlowAnalysis(GenericAnnotatedTypeFactory.java:1518) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.checkAndPerformFlowAnalysis(GenericAnnotatedTypeFactory.java:2132) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.preProcessClassTree(GenericAnnotatedTypeFactory.java:452) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:631) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:197) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860) + at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60) + at org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:91) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1440) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1355) + at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:193) + at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:854) + at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1394) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1351) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176) + at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) + at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) + Caused by: java.lang.Throwable + at org.checkerframework.javacutil.BugInCF.(BugInCF.java:39) + ... 82 more + + Underlying Exception: java.lang.Throwable; java.lang.Throwable + at org.checkerframework.javacutil.BugInCF.(BugInCF.java:39) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.getTypeParameterElement(PropagationTypeAnnotator.java:226) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:132) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedWildcardType.accept(AnnotatedTypeMirror.java:2423) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:58) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:20) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.addDefaultAnnotations(GenericAnnotatedTypeFactory.java:1987) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:872) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:32) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:723) + at org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor.visit(AbstractAtmComboVisitor.java:34) + at org.checkerframework.framework.type.AsSuperVisitor.visit(AsSuperVisitor.java:109) + at org.checkerframework.framework.type.AsSuperVisitor.asSuper(AsSuperVisitor.java:90) + at org.checkerframework.framework.util.AnnotatedTypes.asSuper(AnnotatedTypes.java:120) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:518) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visitTypevar_Typevar(EquivalentAtmComboScanner.java:188) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:589) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:669) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.access$200(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism.resolve(AbstractQualifierPolymorphism.java:212) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUsePreSubstitution(GenericAnnotatedTypeFactory.java:2342) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2634) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2545) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUse(GenericAnnotatedTypeFactory.java:2331) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2505) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:419) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:82) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1813) + at jdk.compiler/com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:81) + at org.checkerframework.framework.type.TypeFromTree.fromExpression(TypeFromTree.java:43) + at org.checkerframework.framework.type.AnnotatedTypeFactory.fromExpression(AnnotatedTypeFactory.java:1861) + at org.checkerframework.framework.type.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:1501) + at org.checkerframework.framework.flow.CFAbstractTransfer.getValueFromFactory(CFAbstractTransfer.java:225) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:1152) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:106) + at org.checkerframework.dataflow.cfg.node.MethodInvocationNode.accept(MethodInvocationNode.java:156) + at org.checkerframework.dataflow.analysis.AbstractAnalysis.callTransferFunction(AbstractAnalysis.java:396) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.callTransferFunction(ForwardAnalysisImpl.java:402) + at org.checkerframework.framework.flow.CFAbstractAnalysis.callTransferFunction(CFAbstractAnalysis.java:246) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysisBlock(ForwardAnalysisImpl.java:157) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysis(ForwardAnalysisImpl.java:110) + at org.checkerframework.framework.flow.CFAbstractAnalysis.performAnalysis(CFAbstractAnalysis.java:155) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.analyze(GenericAnnotatedTypeFactory.java:1629) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.performFlowAnalysis(GenericAnnotatedTypeFactory.java:1518) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.checkAndPerformFlowAnalysis(GenericAnnotatedTypeFactory.java:2132) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.preProcessClassTree(GenericAnnotatedTypeFactory.java:452) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:631) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:197) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860) + at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60) + at org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:91) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1440) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1355) + at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:193) + at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:854) + at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1394) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1351) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176) + at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) + at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) +/Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/CaseFormat.java:[118,28] [[immutability, pico, piconoinit, allcheckers]:implicit.shallow.immutable] Write an explicit mutable qualifier if wants to exclude the field from the abstract state! Otherwise change the class mutability of this object ! +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultimap.java:[118,89] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of HashMultimapGwtSerializationDependencies constructor. + found : @Mutable Map> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultimap.java:[125,89] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of HashMultimapGwtSerializationDependencies constructor. + found : @Mutable Map> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultimap.java:[126,11] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of AbstractMultimap.putAll. + found : @ReceiverDependentMutable Multimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultimap.java:[138,49] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set + method return type: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultimap.java:[148,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Serialization.writeMultimap. + found : @ReceiverDependentMutable HashMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultimap.java:[154,25] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable HashMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultimap.java:[157,10] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setMap(java.util.Map>) not allowed on the given receiver. + found : @ReceiverDependentMutable HashMultimap + required: @Mutable AbstractMapBasedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultimap.java:[158,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Serialization.populateMultimap. + found : @ReceiverDependentMutable HashMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayListMultimap.java:[125,89] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of ArrayListMultimapGwtSerializationDependencies constructor. + found : @Mutable Map> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayListMultimap.java:[134,15] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Multimap" to "@Mutable ArrayListMultimap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayListMultimap.java:[136,10] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to putAll(com.google.common.collect.Multimap) not allowed on the given receiver. + found : @ReceiverDependentMutable ArrayListMultimap + required: @Mutable AbstractMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayListMultimap.java:[136,11] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of AbstractMultimap.putAll. + found : @ReceiverDependentMutable Multimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayListMultimap.java:[169,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Serialization.writeMultimap. + found : @ReceiverDependentMutable ArrayListMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayListMultimap.java:[175,25] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable ArrayListMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayListMultimap.java:[178,10] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setMap(java.util.Map>) not allowed on the given receiver. + found : @ReceiverDependentMutable ArrayListMultimap + required: @Mutable AbstractMapBasedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ArrayListMultimap.java:[179,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Serialization.populateMultimap. + found : @ReceiverDependentMutable ArrayListMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingQueue.java:[104,16] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to add(E) not allowed on the given receiver. + found : @ReceiverDependentMutable ForwardingQueue + required: @Mutable ForwardingCollection +[WARNING] ; The Checker Framework crashed. Please report the crash. Version: Checker Framework 3.49.5-eisop1-SNAPSHOT, branch pico-move-lazy, 2025-10-29, commit 3261311, dirty=true. + Checker: class org.checkerframework.checker.pico.PICONoInitSubchecker + Visitor: class org.checkerframework.checker.pico.PICONoInitVisitor + Compilation unit: /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableRangeMap.java + Last visited tree at line 96 column 38: + Map, ? extends V> map = rangeMap.asMapOfRanges(); + Exception: org.checkerframework.javacutil.BugInCF: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture; org.checkerframework.javacutil.BugInCF: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.getTypeParameterElement(PropagationTypeAnnotator.java:226) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:132) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedWildcardType.accept(AnnotatedTypeMirror.java:2423) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:58) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:20) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.addDefaultAnnotations(GenericAnnotatedTypeFactory.java:1987) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:872) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:32) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:723) + at org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor.visit(AbstractAtmComboVisitor.java:34) + at org.checkerframework.framework.type.AsSuperVisitor.visit(AsSuperVisitor.java:109) + at org.checkerframework.framework.type.AsSuperVisitor.asSuper(AsSuperVisitor.java:90) + at org.checkerframework.framework.util.AnnotatedTypes.asSuper(AnnotatedTypes.java:120) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:518) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visitTypevar_Typevar(EquivalentAtmComboScanner.java:188) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:589) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:669) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.access$200(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism.resolve(AbstractQualifierPolymorphism.java:212) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUsePreSubstitution(GenericAnnotatedTypeFactory.java:2342) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2634) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2545) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUse(GenericAnnotatedTypeFactory.java:2331) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2505) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:419) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:82) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1813) + at jdk.compiler/com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:81) + at org.checkerframework.framework.type.TypeFromTree.fromExpression(TypeFromTree.java:43) + at org.checkerframework.framework.type.AnnotatedTypeFactory.fromExpression(AnnotatedTypeFactory.java:1861) + at org.checkerframework.framework.type.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:1501) + at org.checkerframework.framework.flow.CFAbstractTransfer.getValueFromFactory(CFAbstractTransfer.java:225) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:1152) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:106) + at org.checkerframework.dataflow.cfg.node.MethodInvocationNode.accept(MethodInvocationNode.java:156) + at org.checkerframework.dataflow.analysis.AbstractAnalysis.callTransferFunction(AbstractAnalysis.java:396) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.callTransferFunction(ForwardAnalysisImpl.java:402) + at org.checkerframework.framework.flow.CFAbstractAnalysis.callTransferFunction(CFAbstractAnalysis.java:246) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysisBlock(ForwardAnalysisImpl.java:157) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysis(ForwardAnalysisImpl.java:110) + at org.checkerframework.framework.flow.CFAbstractAnalysis.performAnalysis(CFAbstractAnalysis.java:155) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.analyze(GenericAnnotatedTypeFactory.java:1629) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.performFlowAnalysis(GenericAnnotatedTypeFactory.java:1518) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.checkAndPerformFlowAnalysis(GenericAnnotatedTypeFactory.java:2132) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.preProcessClassTree(GenericAnnotatedTypeFactory.java:452) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:631) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:197) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860) + at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60) + at org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:91) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1440) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1355) + at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:193) + at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:854) + at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1394) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1351) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176) + at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) + at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) + Caused by: java.lang.Throwable + at org.checkerframework.javacutil.BugInCF.(BugInCF.java:39) + ... 82 more + + Underlying Exception: java.lang.Throwable; java.lang.Throwable + at org.checkerframework.javacutil.BugInCF.(BugInCF.java:39) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.getTypeParameterElement(PropagationTypeAnnotator.java:226) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:132) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.visitWildcard(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedWildcardType.accept(AnnotatedTypeMirror.java:2423) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.scan(AnnotatedTypeScanner.java:207) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:75) + at org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator.scan(PropagationTypeAnnotator.java:36) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:58) + at org.checkerframework.framework.type.typeannotator.ListTypeAnnotator.scan(ListTypeAnnotator.java:20) + at org.checkerframework.framework.type.visitor.AnnotatedTypeScanner.visit(AnnotatedTypeScanner.java:195) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.addDefaultAnnotations(GenericAnnotatedTypeFactory.java:1987) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:872) + at org.checkerframework.framework.type.AsSuperVisitor.visitWildcard_Wildcard(AsSuperVisitor.java:32) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:723) + at org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor.visit(AbstractAtmComboVisitor.java:34) + at org.checkerframework.framework.type.AsSuperVisitor.visit(AsSuperVisitor.java:109) + at org.checkerframework.framework.type.AsSuperVisitor.asSuper(AsSuperVisitor.java:90) + at org.checkerframework.framework.util.AnnotatedTypes.asSuper(AnnotatedTypes.java:120) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:518) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visitTypevar_Typevar(EquivalentAtmComboScanner.java:188) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:589) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitTypevar_Typevar(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:669) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:556) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visitDeclared_Declared(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:315) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.scan(EquivalentAtmComboScanner.java:57) + at org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner.visit(EquivalentAtmComboScanner.java:37) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.visit(AbstractQualifierPolymorphism.java:529) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism$PolyCollector.access$200(AbstractQualifierPolymorphism.java:395) + at org.checkerframework.framework.type.poly.AbstractQualifierPolymorphism.resolve(AbstractQualifierPolymorphism.java:212) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUsePreSubstitution(GenericAnnotatedTypeFactory.java:2342) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2634) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2545) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.methodFromUse(GenericAnnotatedTypeFactory.java:2331) + at org.checkerframework.framework.type.AnnotatedTypeFactory.methodFromUse(AnnotatedTypeFactory.java:2505) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:419) + at org.checkerframework.framework.type.TypeFromExpressionVisitor.visitMethodInvocation(TypeFromExpressionVisitor.java:82) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1813) + at jdk.compiler/com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:81) + at org.checkerframework.framework.type.TypeFromTree.fromExpression(TypeFromTree.java:43) + at org.checkerframework.framework.type.AnnotatedTypeFactory.fromExpression(AnnotatedTypeFactory.java:1861) + at org.checkerframework.framework.type.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:1501) + at org.checkerframework.framework.flow.CFAbstractTransfer.getValueFromFactory(CFAbstractTransfer.java:225) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:1152) + at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:106) + at org.checkerframework.dataflow.cfg.node.MethodInvocationNode.accept(MethodInvocationNode.java:156) + at org.checkerframework.dataflow.analysis.AbstractAnalysis.callTransferFunction(AbstractAnalysis.java:396) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.callTransferFunction(ForwardAnalysisImpl.java:402) + at org.checkerframework.framework.flow.CFAbstractAnalysis.callTransferFunction(CFAbstractAnalysis.java:246) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysisBlock(ForwardAnalysisImpl.java:157) + at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysis(ForwardAnalysisImpl.java:110) + at org.checkerframework.framework.flow.CFAbstractAnalysis.performAnalysis(CFAbstractAnalysis.java:155) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.analyze(GenericAnnotatedTypeFactory.java:1629) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.performFlowAnalysis(GenericAnnotatedTypeFactory.java:1518) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.checkAndPerformFlowAnalysis(GenericAnnotatedTypeFactory.java:2132) + at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.preProcessClassTree(GenericAnnotatedTypeFactory.java:452) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:631) + at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:197) + at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860) + at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60) + at org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:91) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1440) + at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1355) + at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:193) + at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:854) + at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1394) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1351) + at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317) + at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176) + at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) + at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) +/Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EmptyContiguousSet.java:[157,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable EmptyContiguousSet> + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EmptyContiguousSet.java:[157,13] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for EmptyContiguousSet constructor + unsatisfiable constraint: inference type: com.google.common.collect.EmptyContiguousSet <: @Mutable Object + inference type: com.google.common.collect.EmptyContiguousSet -> @Mutable Object + From: Constraint between method call type and target type for method call:new EmptyContiguousSet<>(domain) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ContiguousSet.java:[110,30] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : @Immutable Integer + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ContiguousSet.java:[111,17] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ContiguousSet.create + unsatisfiable constraint: @Immutable Integer <: @Mutable Comparable + @Immutable Integer <: use of C from Range.closed(lower, upper) + From complementary bound.: @Immutable Integer -> use of C from Range.closed(lower, upper) + @Immutable int -> use of C from Range.closed(lower, upper) + lower -> use of C from Range.closed(lower, upper) + From: Argument constraint + @Immutable Integer <: @Mutable Comparable + use of C from Range.closed(lower, upper) = use of C from create(Range.closed(lower, upper), DiscreteDomain.integers()) + From complementary bound.: use of C from Range.closed(lower, upper) <= use of C from create(Range.closed(lower, upper), DiscreteDomain.integers()) + inference type: com.google.common.collect.Range <: inference type: com.google.common.collect.Range + inference type: com.google.common.collect.Range -> inference type: com.google.common.collect.Range + From: Constraint between method call type and target type for method call:Range.closed(lower, upper) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ContiguousSet.java:[123,30] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : @Immutable Long + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ContiguousSet.java:[124,17] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ContiguousSet.create + unsatisfiable constraint: @Immutable Long <: @Mutable Comparable + @Immutable Long <: use of C from Range.closed(lower, upper) + From complementary bound.: @Immutable Long -> use of C from Range.closed(lower, upper) + @Immutable long -> use of C from Range.closed(lower, upper) + lower -> use of C from Range.closed(lower, upper) + From: Argument constraint + @Immutable Long <: @Mutable Comparable + use of C from Range.closed(lower, upper) = use of C from create(Range.closed(lower, upper), DiscreteDomain.longs()) + From complementary bound.: use of C from Range.closed(lower, upper) <= use of C from create(Range.closed(lower, upper), DiscreteDomain.longs()) + inference type: com.google.common.collect.Range <: inference type: com.google.common.collect.Range + inference type: com.google.common.collect.Range -> inference type: com.google.common.collect.Range + From: Constraint between method call type and target type for method call:Range.closed(lower, upper) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ContiguousSet.java:[136,30] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : @Immutable Integer + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ContiguousSet.java:[137,17] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ContiguousSet.create + unsatisfiable constraint: @Immutable Integer <: @Mutable Comparable + @Immutable Integer <: use of C from Range.closedOpen(lower, upper) + From complementary bound.: @Immutable Integer -> use of C from Range.closedOpen(lower, upper) + @Immutable int -> use of C from Range.closedOpen(lower, upper) + lower -> use of C from Range.closedOpen(lower, upper) + From: Argument constraint + @Immutable Integer <: @Mutable Comparable + use of C from Range.closedOpen(lower, upper) = use of C from create(Range.closedOpen(lower, upper), DiscreteDomain.integers()) + From complementary bound.: use of C from Range.closedOpen(lower, upper) <= use of C from create(Range.closedOpen(lower, upper), DiscreteDomain.integers()) + inference type: com.google.common.collect.Range <: inference type: com.google.common.collect.Range + inference type: com.google.common.collect.Range -> inference type: com.google.common.collect.Range + From: Constraint between method call type and target type for method call:Range.closedOpen(lower, upper) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ContiguousSet.java:[149,30] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : @Immutable Long + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ContiguousSet.java:[150,17] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ContiguousSet.create + unsatisfiable constraint: @Immutable Long <: @Mutable Comparable + @Immutable Long <: use of C from Range.closedOpen(lower, upper) + From complementary bound.: @Immutable Long -> use of C from Range.closedOpen(lower, upper) + @Immutable long -> use of C from Range.closedOpen(lower, upper) + lower -> use of C from Range.closedOpen(lower, upper) + From: Argument constraint + @Immutable Long <: @Mutable Comparable + use of C from Range.closedOpen(lower, upper) = use of C from create(Range.closedOpen(lower, upper), DiscreteDomain.longs()) + From complementary bound.: use of C from Range.closedOpen(lower, upper) <= use of C from create(Range.closedOpen(lower, upper), DiscreteDomain.longs()) + inference type: com.google.common.collect.Range <: inference type: com.google.common.collect.Range + inference type: com.google.common.collect.Range -> inference type: com.google.common.collect.Range + From: Constraint between method call type and target type for method call:Range.closedOpen(lower, upper) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java:[100,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter label of ListenerCallQueue.enqueueHelper. + found : @Immutable String + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMultiset.java:[50,87] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularImmutableMultiset.create. + found : @Immutable ImmutableList<@Mutable Entry<@Mutable Object>> + required: @Mutable Collection> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMultiset.java:[92,43] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for JdkBackedImmutableMultiset.create + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + use of E from JdkBackedImmutableMultiset.create(ImmutableList.asImmutableList(entryArray)) = E extends @Readonly Object + From complementary bound.: use of E from JdkBackedImmutableMultiset.create(ImmutableList.asImmutableList(entryArray)) <= E extends @Readonly Object + inference type: com.google.common.collect.ImmutableMultiset <: @Immutable ImmutableMultiset + inference type: com.google.common.collect.ImmutableMultiset -> @Immutable ImmutableMultiset + From: Constraint between method call type and target type for method call:JdkBackedImmutableMultiset.create(ImmutableList.asImmutableList(entryArray)) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMultiset.java:[143,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable ImmutableEntry @Mutable [] + required: @Immutable ImmutableEntry @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMultiset.java:[144,21] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable ImmutableEntry @Mutable [] + required: @Immutable ImmutableEntry @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMultiset.java:[196,85] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of ElementSet constructor. + found : @Immutable List<@Mutable Entry> + required: @Mutable List<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMultiset.java:[196,85] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Arrays.asList + unsatisfiable constraint: @Immutable ImmutableEntry <: @Mutable Entry + use of T from Arrays.asList(entries) = @Mutable Entry + From complementary bound.: use of T from Arrays.asList(entries) <= @Mutable Entry + inference type: java.util.List <: @Mutable List<@Mutable Entry> + inference type: java.util.List -> @Mutable List<@Mutable Entry> + From: Constraint between method call type and target type for method call:Arrays.asList(entries) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMultiset.java:[196,96] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of ElementSet constructor. + found : @Immutable RegularImmutableMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMultiset.java:[201,18] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableEntry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapValues.java:[58,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable ImmutableMapValues.@Readonly (@Immutable ImmutableMapValues this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapValues.java:[68,28] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable UnmodifiableIterator<@Mutable Entry> + required: @Mutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapValues.java:[80,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter iterator of Iterators.contains. + found : @Readonly UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapValues.java:[91,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable ImmutableMapValues.@Readonly (@Immutable ImmutableMapValues this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapValues.java:[91,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly ImmutableList + method return type: @Immutable ImmutableList +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Comparators.java:[167,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter comparator of Comparators.least. + found : @Readonly Comparator + required: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[152,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[163,18] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Node + required: @ReceiverDependentMutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[164,18] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Node + required: @ReceiverDependentMutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[218,54] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Map> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[223,10] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to putAll(com.google.common.collect.Multimap) not allowed on the given receiver. + found : @ReceiverDependentMutable LinkedListMultimap + required: @Mutable AbstractMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[293,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PICOLost Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[293,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PICOLost Node + required: @PICOLost Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[295,17] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PICOLost Node + required: @Mutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[298,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PICOLost Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[298,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PICOLost Node + required: @PICOLost Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[300,17] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PICOLost Node + required: @Mutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[318,37] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PICOLost Node + required: @Mutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[318,37] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @PICOLost Node <: @Mutable Node + use of T from requireNonNull(node.nextSibling) <: @Mutable Node + From complementary bound.: use of T from requireNonNull(node.nextSibling) -> @Mutable Node + From: Constraint between method call type and target type for method call:requireNonNull(node.nextSibling) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[320,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PICOLost Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[320,47] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PICOLost Node + required: @PICOLost Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[325,37] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PICOLost Node + required: @Mutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[325,37] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @PICOLost Node <: @Mutable Node + use of T from requireNonNull(node.previousSibling) <: @Mutable Node + From complementary bound.: use of T from requireNonNull(node.previousSibling) -> @Mutable Node + From: Constraint between method call type and target type for method call:requireNonNull(node.previousSibling) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[327,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PICOLost Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[327,47] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PICOLost Node + required: @PICOLost Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[351,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Node + required: @ReceiverDependentMutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[357,15] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Node + required: @ReceiverDependentMutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[386,15] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable LinkedListMultimap.@ReceiverDependentMutable NodeIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[387,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Node + method return type: @Mutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[420,15] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable LinkedListMultimap.@ReceiverDependentMutable NodeIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[421,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Node + method return type: @Mutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[446,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[452,62] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable HashSet + required: @ReceiverDependentMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[453,48] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Node + required: @ReceiverDependentMutable Node +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[477,18] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to add(E) not allowed on the given receiver. + found : @ReceiverDependentMutable Set + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[480,46] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to add(E) not allowed on the given receiver. + found : @ReceiverDependentMutable Set + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[490,23] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable LinkedListMultimap.@ReceiverDependentMutable DistinctKeyIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[690,27] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List + method return type: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[707,16] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[780,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of Keys constructor. + found : @ReceiverDependentMutable LinkedListMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[794,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Collection" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[845,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Collection<@ReceiverDependentMutable Entry>" to "@Mutable List<@Mutable Entry>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[880,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable AsMap + method return type: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[880,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of AsMap constructor. + found : @ReceiverDependentMutable LinkedListMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[901,17] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable LinkedListMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[901,40] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable LinkedHashMap> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[905,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[908,9] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to put(K,V) not allowed on the given receiver. + found : @ReceiverDependentMutable LinkedListMultimap + required: @Mutable LinkedListMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedListMultimap.java:[927,83] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Map> + method return type: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[191,30] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Cell" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[297,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter table of Tables.transpose. + found : @Readonly Table + required: @Mutable Table +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[336,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Cell<@Immutable Object, @Immutable Object, @Readonly Object> + method return type: @Mutable Cell +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[343,49] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to cellSet() not allowed on the given receiver. + found : @PICOLost Table + required: @PICOLost Table +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[349,53] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to cellSet() not allowed on the given receiver. + found : @PICOLost Table + required: @PICOLost Table +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[444,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Function + required: @ReceiverDependentMutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[444,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Function <: @ReceiverDependentMutable Function + use of T from checkNotNull(function) <: @ReceiverDependentMutable Function + From complementary bound.: use of T from checkNotNull(function) -> @ReceiverDependentMutable Function + From: Constraint between method call type and target type for method call:checkNotNull(function) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[459,26] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to apply(F) not allowed on the given receiver. + found : @PICOLost Function + required: @PICOLost Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[492,69] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove(@org.checkerframework.checker.pico.qual.Readonly java.lang.Object,@org.checkerframework.checker.pico.qual.Readonly java.lang.Object) not allowed on the given receiver. + found : @ReceiverDependentMutable Table + required: @Mutable Table +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[498,33] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map + method return type: @PolyMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[498,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformValues. + found : @PolyMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[498,57] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Maps.transformValues. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[503,33] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map + method return type: @PolyMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[503,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformValues. + found : @PolyMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[503,63] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Maps.transformValues. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[510,30] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Cell + method return type: @Mutable Cell +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[518,50] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to cellSet() not allowed on the given receiver. + found : @PICOLost Table + required: @PICOLost Table +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[518,77] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to cellFunction() not allowed on the given receiver. + found : @Readonly TransformedTable + required: @PICOLost TransformedTable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[523,54] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to cellSet() not allowed on the given receiver. + found : @PICOLost Table + required: @PICOLost Table +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[523,84] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to cellFunction() not allowed on the given receiver. + found : @Readonly TransformedTable + required: @PICOLost TransformedTable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[538,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Collection + method return type: @PolyMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[538,52] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromCollection of Collections2.transform. + found : @PolyMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[538,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter function of Collections2.transform. + found : @PolyMutable Function + required: @Mutable Function +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[550,33] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map> + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[550,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformValues. + found : @PolyMutable Map> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[562,33] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map> + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[562,53] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformValues. + found : @PolyMutable Map> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[596,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Table" to "@Mutable Table" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[647,40] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Map + method return type: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[652,40] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[658,40] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Map> + method return type: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[663,47] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Collection + method return type: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[704,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Table" to "@Mutable RowSortedTable" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[710,85] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to rowMap() not allowed on the given receiver. + found : @Readonly RowSortedTable + required: @PICOLost RowSortedTable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[715,67] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to rowKeySet() not allowed on the given receiver. + found : @Readonly RowSortedTable + required: @PICOLost RowSortedTable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Tables.java:[773,28] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Table" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[42,87] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[50,24] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[52,30] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ContiguousSet.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from ContiguousSet.create(range.intersection(other), domain) + From complementary bound.: C extends @Readonly Comparable <= use of C from ContiguousSet.create(range.intersection(other), domain) + @Immutable Range> <: inference type: com.google.common.collect.Range + @Immutable Range> -> inference type: com.google.common.collect.Range + range.intersection(other) -> inference type: com.google.common.collect.Range + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[53,33] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of EmptyContiguousSet. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[57,16] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[58,49] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.upTo + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable <: use of C from Range.upTo(toElement, BoundType.forBoolean(inclusive)) + From complementary bound.: C extends @Readonly Comparable -> use of C from Range.upTo(toElement, BoundType.forBoolean(inclusive)) + toElement -> use of C from Range.upTo(toElement, BoundType.forBoolean(inclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[62,16] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[66,13] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for EmptyContiguousSet constructor + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from new EmptyContiguousSet<>(domain) + From complementary bound.: C extends @Readonly Comparable <= use of C from new EmptyContiguousSet<>(domain) + @Immutable DiscreteDomain> <: inference type: com.google.common.collect.DiscreteDomain + @Immutable DiscreteDomain> -> inference type: com.google.common.collect.DiscreteDomain + domain -> inference type: com.google.common.collect.DiscreteDomain + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[69,19] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.range + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable <: use of C from Range.range(fromElement, BoundType.forBoolean(fromInclusive), toElement, BoundType.forBoolean(toInclusive)) + From complementary bound.: C extends @Readonly Comparable -> use of C from Range.range(fromElement, BoundType.forBoolean(fromInclusive), toElement, BoundType.forBoolean(toInclusive)) + fromElement -> use of C from Range.range(fromElement, BoundType.forBoolean(fromInclusive), toElement, BoundType.forBoolean(toInclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[75,16] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[76,51] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.downTo + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable <: use of C from Range.downTo(fromElement, BoundType.forBoolean(inclusive)) + From complementary bound.: C extends @Readonly Comparable -> use of C from Range.downTo(fromElement, BoundType.forBoolean(inclusive)) + fromElement -> use of C from Range.downTo(fromElement, BoundType.forBoolean(inclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[88,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable UnmodifiableIterator> + method return type: @Immutable UnmodifiableIterator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[94,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter left of RegularContiguousSet.equalsOrThrow. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[94,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter right of RegularContiguousSet.equalsOrThrow. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[102,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable UnmodifiableIterator> + method return type: @Immutable UnmodifiableIterator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[108,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter left of RegularContiguousSet.equalsOrThrow. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[108,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter right of RegularContiguousSet.equalsOrThrow. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[137,13] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable RegularContiguousSet>.@Readonly (@Immutable RegularContiguousSet> this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[137,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly ImmutableList> + method return type: @Immutable ImmutableList> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[145,35] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to size() not allowed on the given receiver. + found : @Immutable RegularContiguousSet>.@Mutable + required: @Immutable ImmutableAsList> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[183,23] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[183,53] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of ContiguousSet. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[192,32] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ContiguousSet.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable <: use of C from Range.closed(lowerEndpoint, upperEndpoint) + From complementary bound.: C extends @Readonly Comparable -> use of C from Range.closed(lowerEndpoint, upperEndpoint) + lowerEndpoint -> use of C from Range.closed(lowerEndpoint, upperEndpoint) + From: Argument constraint + C extends @Readonly Comparable <: @Mutable Comparable + use of C from Range.closed(lowerEndpoint, upperEndpoint) = use of C from ContiguousSet.create(Range.closed(lowerEndpoint, upperEndpoint), domain) + From complementary bound.: use of C from Range.closed(lowerEndpoint, upperEndpoint) <= use of C from ContiguousSet.create(Range.closed(lowerEndpoint, upperEndpoint), domain) + inference type: com.google.common.collect.Range <: inference type: com.google.common.collect.Range + inference type: com.google.common.collect.Range -> inference type: com.google.common.collect.Range + From: Constraint between method call type and target type for method call:Range.closed(lowerEndpoint, upperEndpoint) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[193,35] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of EmptyContiguousSet. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[204,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from Range.create(range.lowerBound.withLowerBoundType(lowerBoundType, domain), range.upperBound.withUpperBoundType(upperBoundType, domain)) + From complementary bound.: C extends @Readonly Comparable <= use of C from Range.create(range.lowerBound.withLowerBoundType(lowerBoundType, domain), range.upperBound.withUpperBoundType(upperBoundType, domain)) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + range.lowerBound.withLowerBoundType(lowerBoundType, domain) -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[239,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable RegularContiguousSet> + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[239,13] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for RegularContiguousSet constructor + unsatisfiable constraint: inference type: com.google.common.collect.RegularContiguousSet <: @Mutable Object + inference type: com.google.common.collect.RegularContiguousSet -> @Mutable Object + From: Constraint between method call type and target type for method call:new RegularContiguousSet<>(range, domain) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularContiguousSet.java:[246,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for SerializedForm constructor + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from new SerializedForm<>(range, domain) + From complementary bound.: C extends @Readonly Comparable <= use of C from new SerializedForm<>(range, domain) + @Immutable Range> <: inference type: com.google.common.collect.Range + @Immutable Range> -> inference type: com.google.common.collect.Range + range -> inference type: com.google.common.collect.Range + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/ServiceManagerBridge.java:[31,27] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V of ImmutableMultimap. + found : @Mutable Service + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/Striped.java:[146,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableList + method return type: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/Striped.java:[155,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg1 of List.set. + found : L extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/Striped.java:[161,27] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg1 of List.set. + found : L extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/Striped.java:[184,39] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List + method return type: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/Striped.java:[373,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : L extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[126,48] [[immutability, pico, piconoinit, allcheckers]:implicit.shallow.immutable] Write an explicit mutable qualifier if wants to exclude the field from the abstract state! Otherwise change the class mutability of this object ! +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[127,42] [[immutability, pico, piconoinit, allcheckers]:implicit.shallow.immutable] Write an explicit mutable qualifier if wants to exclude the field from the abstract state! Otherwise change the class mutability of this object ! +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[134,18] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[140,18] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[141,14] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of TreeMultiset.successor. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[141,22] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter b of TreeMultiset.successor. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[274,19] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of TreeMultiset.count. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[397,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of TreeMultiset.count. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[566,8] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter endLink of TreeMultiset constructor. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[574,8] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter endLink of TreeMultiset constructor. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[652,27] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[652,27] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @ReceiverDependentMutable AvlNode <: @Mutable AvlNode + use of T from requireNonNull(pred) <: @Mutable AvlNode + From complementary bound.: use of T from requireNonNull(pred) -> @Mutable AvlNode + From: Constraint between method call type and target type for method call:requireNonNull(pred) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[656,27] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[656,27] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @ReceiverDependentMutable AvlNode <: @Mutable AvlNode + use of T from requireNonNull(succ) <: @Mutable AvlNode + From complementary bound.: use of T from requireNonNull(succ) -> @Mutable AvlNode + From: Constraint between method call type and target type for method call:requireNonNull(succ) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[671,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[671,14] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[672,16] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of TreeMultiset.successor. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[672,22] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter b of TreeMultiset.successor. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[676,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[680,11] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[680,13] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[681,24] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter b of TreeMultiset.successor. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[681,30] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter c of TreeMultiset.successor. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[685,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[703,13] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[703,27] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[708,43] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[717,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[717,29] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[722,44] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[731,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[742,17] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[745,13] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[745,30] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[755,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[760,17] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[763,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[763,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[783,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[795,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[798,13] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[798,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[812,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[815,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[815,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[834,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[852,17] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[855,13] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[855,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[873,17] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[876,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[876,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[898,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[907,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[909,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[914,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[921,22] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[932,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[934,13] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[934,29] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[945,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[947,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[947,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[956,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter node of TreeMultiset.distinctElements. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[956,82] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter node of TreeMultiset.distinctElements. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[957,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter node of AvlNode.totalCount. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[957,66] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter node of AvlNode.totalCount. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[961,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter node of AvlNode.height. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[961,54] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter node of AvlNode.height. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[975,18] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[975,37] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[982,17] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[982,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable AvlNode + required: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[987,17] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[992,20] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter node of AvlNode.height. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[992,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter node of AvlNode.height. + found : @ReceiverDependentMutable AvlNode + required: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[998,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[999,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1004,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1010,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1011,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1016,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1031,30] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1031,63] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for MoreObjects.firstNonNull + unsatisfiable constraint: @ReceiverDependentMutable AvlNode <: @Mutable AvlNode + use of T from MoreObjects.firstNonNull(left.ceiling(comparator, e), this) <: @Mutable AvlNode + From complementary bound.: use of T from MoreObjects.firstNonNull(left.ceiling(comparator, e), this) -> @Mutable AvlNode + From: Constraint between method call type and target type for method call:MoreObjects.firstNonNull(left.ceiling(comparator, e), this) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1033,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1043,31] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1043,64] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for MoreObjects.firstNonNull + unsatisfiable constraint: @ReceiverDependentMutable AvlNode <: @Mutable AvlNode + use of T from MoreObjects.firstNonNull(right.floor(comparator, e), this) <: @Mutable AvlNode + From complementary bound.: use of T from MoreObjects.firstNonNull(right.floor(comparator, e), this) -> @Mutable AvlNode + From: Constraint between method call type and target type for method call:MoreObjects.firstNonNull(right.floor(comparator, e), this) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1045,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable AvlNode + method return type: @Mutable AvlNode +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1092,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of Serialization.writeMultiset. + found : @ReceiverDependentMutable TreeMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1101,81] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter instance of FieldSetter.set. + found : @ReceiverDependentMutable TreeMultiset + required: @Mutable AbstractSortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1103,13] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter instance of FieldSetter.set. + found : @ReceiverDependentMutable TreeMultiset + required: @Mutable TreeMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1105,13] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter instance of FieldSetter.set. + found : @ReceiverDependentMutable TreeMultiset + required: @Mutable TreeMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1107,67] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter instance of FieldSetter.set. + found : @ReceiverDependentMutable TreeMultiset + required: @Mutable TreeMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeMultiset.java:[1109,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of Serialization.populateMultiset. + found : @ReceiverDependentMutable TreeMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedMultiset.java:[52,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Comparator + required: @ReceiverDependentMutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedMultiset.java:[52,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Comparator <: @ReceiverDependentMutable Comparator + use of T from checkNotNull(comparator) <: @ReceiverDependentMutable Comparator + From complementary bound.: use of T from checkNotNull(comparator) -> @ReceiverDependentMutable Comparator + From: Constraint between method call type and target type for method call:checkNotNull(comparator) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedMultiset.java:[57,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Set" to "@Mutable NavigableSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedMultiset.java:[62,53] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of NavigableElementSet constructor. + found : @ReceiverDependentMutable AbstractSortedMultiset + required: @Mutable SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedMultiset.java:[67,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Comparator + method return type: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedMultiset.java:[92,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedMultiset.java:[105,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedMultiset.java:[133,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable SortedMultiset + method return type: @Mutable SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedMultiset.java:[133,49] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable AbstractSortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractSortedMultiset.java:[133,75] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable SortedMultiset + required: @ReceiverDependentMutable SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java:[45,10] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter unfiltered of FilteredEntryMultimap constructor. + found : @ReceiverDependentMutable SetMultimap + required: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java:[55,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Collection" to "@PolyMutable Set" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java:[70,22] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set<@PolyMutable Entry> + method return type: @PolyMutable Set<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java:[70,22] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Sets.filter + unsatisfiable constraint: @PolyMutable Entry <: @Mutable Entry + use of E from Sets.filter(unfiltered().entries(), entryPredicate()) <: capture#0298 extends @Readonly Object super @Mutable Entry + From complementary bound.: capture#0298 extends @Readonly Object super @Mutable Entry <= inference type: ? super E + @Mutable Predicate> <: inference type: com.google.common.base.Predicate + @Mutable Predicate> -> inference type: com.google.common.base.Predicate + entryPredicate() -> inference type: com.google.common.base.Predicate + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[59,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Multimap + required: @ReceiverDependentMutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[59,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Multimap <: @ReceiverDependentMutable Multimap + use of T from checkNotNull(unfiltered) <: @ReceiverDependentMutable Multimap + From complementary bound.: use of T from checkNotNull(unfiltered) -> @ReceiverDependentMutable Multimap + From: Constraint between method call type and target type for method call:checkNotNull(unfiltered) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[60,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Predicate> + required: @ReceiverDependentMutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[60,33] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable Predicate> <: @ReceiverDependentMutable Predicate> + use of T from checkNotNull(predicate) <: @ReceiverDependentMutable Predicate> + From complementary bound.: use of T from checkNotNull(predicate) -> @ReceiverDependentMutable Predicate> + From: Constraint between method call type and target type for method call:checkNotNull(predicate) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[65,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Multimap + method return type: @Mutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[70,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Predicate> + method return type: @Mutable Predicate> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[79,46] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter input of Predicate.apply. + found : @Immutable Entry + required: capture#0302 extends @Readonly Object super @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[111,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Collection + method return type: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[111,35] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for MoreObjects.firstNonNull + unsatisfiable constraint: @ReceiverDependentMutable Collection <: @Mutable Collection + use of T from MoreObjects.firstNonNull(asMap().remove(key), unmodifiableEmptyCollection()) <: @Mutable Collection + From complementary bound.: use of T from MoreObjects.firstNonNull(asMap().remove(key), unmodifiableEmptyCollection()) -> @Mutable Collection + From: Constraint between method call type and target type for method call:MoreObjects.firstNonNull(asMap().remove(key), unmodifiableEmptyCollection()) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[117,8] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Collection + method return type: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[123,19] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable Collection<@ReceiverDependentMutable Entry> + required: @Mutable Collection<@ReceiverDependentMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[128,42] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter collection of FilteredEntryMultimap.filterCollection. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[133,27] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for FilteredEntryMultimap.filterCollection + unsatisfiable constraint: @ReceiverDependentMutable Entry <: @Mutable Entry + use of E from filterCollection(unfiltered.entries(), predicate) <: capture#0300 extends @Readonly Object super @Mutable Entry + From complementary bound.: capture#0300 extends @Readonly Object super @Mutable Entry <= inference type: ? super E + @ReceiverDependentMutable Predicate> <: inference type: com.google.common.base.Predicate + @ReceiverDependentMutable Predicate> -> inference type: com.google.common.base.Predicate + predicate -> inference type: com.google.common.base.Predicate + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[138,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multimap of FilteredMultimapValues constructor. + found : @ReceiverDependentMutable FilteredEntryMultimap + required: @Mutable FilteredMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[153,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[157,92] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@ReceiverDependentMutable Entry>> + required: @Readonly Iterator<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[163,70] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter input of Predicate.apply. + found : @Immutable Entry> + required: capture#0303 extends @Readonly Object super @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[195,12] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[208,12] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[221,42] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Collections.unmodifiableSet + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object <: use of E from Sets.newLinkedHashSet(result) + From complementary bound.: V extends @Readonly Object <= inference type: ? extends E + @Mutable List <: inference type: java.lang.Iterable + @Mutable List -> inference type: java.lang.Iterable + result -> inference type: java.lang.Iterable + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[277,44] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry> + method return type: @Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[300,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable FilteredEntryMultimap.@Mutable AsMap.@Mutable EntrySetImpl + method return type: @Mutable Set<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[371,12] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredEntryMultimap.java:[409,46] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter input of Predicate.apply. + found : @Immutable Entry + required: capture#0304 extends @Readonly Object super @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SingletonImmutableTable.java:[63,26] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableMap.of + unsatisfiable constraint: @Mutable Map <: @Immutable Object + @Mutable Map <: use of V from ImmutableMap.of(singleColumnKey, (Map)ImmutableMap.of(singleRowKey, singleValue)) + From complementary bound.: @Mutable Map -> use of V from ImmutableMap.of(singleColumnKey, (Map)ImmutableMap.of(singleRowKey, singleValue)) + (Map)ImmutableMap.of(singleRowKey, singleValue) -> use of V from ImmutableMap.of(singleColumnKey, (Map)ImmutableMap.of(singleRowKey, singleValue)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SingletonImmutableTable.java:[68,26] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableMap.of + unsatisfiable constraint: @Mutable Map <: @Immutable Object + @Mutable Map <: use of V from ImmutableMap.of(singleRowKey, (Map)ImmutableMap.of(singleColumnKey, singleValue)) + From complementary bound.: @Mutable Map -> use of V from ImmutableMap.of(singleRowKey, (Map)ImmutableMap.of(singleColumnKey, singleValue)) + (Map)ImmutableMap.of(singleColumnKey, singleValue) -> use of V from ImmutableMap.of(singleRowKey, (Map)ImmutableMap.of(singleColumnKey, singleValue)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Queues.java:[218,26] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter E of PriorityBlockingQueue. + found : E extends @Mutable Comparable + required: @PICOLost Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Queues.java:[444,29] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Synchronized.queue + unsatisfiable constraint: E extends @Readonly Object <: @Mutable Object + E extends @Readonly Object = use of E from Synchronized.queue(queue, null) + From complementary bound.: E extends @Readonly Object <= use of E from Synchronized.queue(queue, null) + @Mutable Queue <: inference type: java.util.Queue + @Mutable Queue -> inference type: java.util.Queue + queue -> inference type: java.util.Queue + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java:[33,80] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V of ImmutableSetMultimap. + found : @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java:[37,66] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of ImmutableSetMultimap constructor. + found : @Immutable ImmutableMap<@Immutable Object, @Immutable ImmutableSet<@Mutable Object>> + required: @Immutable ImmutableMap<@Immutable Object, @Immutable ImmutableSet<@Readonly Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java:[41,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable EmptyImmutableSetMultimap + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SortedMultisets.java:[54,22] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable SortedMultiset + required: @ReceiverDependentMutable SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SortedMultisets.java:[59,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable SortedMultiset + method return type: @Mutable SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SortedMultisets.java:[90,30] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for SortedMultisets.getElementOrThrow + unsatisfiable constraint: E extends @Readonly Object <: @Mutable Object + E extends @Readonly Object = use of E from getElementOrThrow(multiset().firstEntry()) + From complementary bound.: E extends @Readonly Object <= use of E from getElementOrThrow(multiset().firstEntry()) + @Mutable Entry <: inference type: com.google.common.collect.Multiset.Entry + @Mutable Entry -> inference type: com.google.common.collect.Multiset.Entry + multiset().firstEntry() -> inference type: com.google.common.collect.Multiset.Entry + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SortedMultisets.java:[96,30] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for SortedMultisets.getElementOrThrow + unsatisfiable constraint: E extends @Readonly Object <: @Mutable Object + E extends @Readonly Object = use of E from getElementOrThrow(multiset().lastEntry()) + From complementary bound.: E extends @Readonly Object <= use of E from getElementOrThrow(multiset().lastEntry()) + @Mutable Entry <: inference type: com.google.common.collect.Multiset.Entry + @Mutable Entry -> inference type: com.google.common.collect.Multiset.Entry + multiset().lastEntry() -> inference type: com.google.common.collect.Multiset.Entry + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ExplicitOrdering.java:[55,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of IncomparableValueException constructor. + found : T extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java:[56,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable long @Mutable [] + required: @Immutable long @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java:[64,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable long @Mutable [] + required: @Immutable long @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java:[75,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java:[135,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter cumulativeCounts of RegularImmutableSortedMultiset constructor. + found : @Immutable long @Immutable [] + required: @Immutable long @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMultiset.java:[134,51] [[immutability, pico, piconoinit, allcheckers]:varargs.type.incompatible] incompatible types in varargs. + found : E extends @Mutable Comparable> @Mutable [] + required: E extends @Mutable Comparable> @PICOBottom [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMultiset.java:[144,51] [[immutability, pico, piconoinit, allcheckers]:varargs.type.incompatible] incompatible types in varargs. + found : E extends @Mutable Comparable> @Mutable [] + required: E extends @Mutable Comparable> @PICOBottom [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMultiset.java:[155,51] [[immutability, pico, piconoinit, allcheckers]:varargs.type.incompatible] incompatible types in varargs. + found : E extends @Mutable Comparable> @Mutable [] + required: E extends @Mutable Comparable> @PICOBottom [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMultiset.java:[166,51] [[immutability, pico, piconoinit, allcheckers]:varargs.type.incompatible] incompatible types in varargs. + found : E extends @Mutable Comparable> @Mutable [] + required: E extends @Mutable Comparable> @PICOBottom [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMultiset.java:[270,75] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of ImmutableSortedMultiset.copyOfSortedEntries. + found : @Immutable ImmutableList<@Mutable Entry> + required: @Mutable Collection<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMultiset.java:[346,32] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ImmutableSortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMultiset.java:[598,26] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSortedMultiset + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMultiset.java:[604,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of SerializedForm constructor. + found : @Immutable ImmutableSortedMultiset + required: @Mutable SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MutableClassToInstanceMap.java:[128,31] [[immutability, pico, piconoinit, allcheckers]:type.argument.inference.crashed] Type argument inference crashed for MutableClassToInstanceMap.checkedEntry + error: An exception occurred: False bound for: Constraint: inference type: capture#691 of ? extends B <: B extends @Readonly Object Result: FALSE +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedMultiset.java:[139,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedMultiset.java:[162,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedMultiset.java:[186,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedMultiset.java:[211,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[53,24] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable DescendingMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[53,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Comparator + method return type: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[53,82] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Ordering + required: @ReceiverDependentMutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[55,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Comparator + method return type: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[64,24] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable DescendingMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[64,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[64,26] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableElementSet + required: @ReceiverDependentMutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[64,68] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of NavigableElementSet constructor. + found : @ReceiverDependentMutable DescendingMultiset + required: @Mutable SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[66,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[131,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Set<@Mutable Entry> + method return type: @Mutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[131,39] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable DescendingMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[131,55] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set<@Mutable Entry> + required: @ReceiverDependentMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[162,26] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @ReceiverDependentMutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DescendingMultiset.java:[168,27] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of ForwardingCollection.standardToArray. + found : T extends @Mutable Object @Mutable [] + required: T extends @Mutable Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/escape/CharEscaper.java:[166,22] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of String constructor. + found : @Immutable char @Mutable [] + required: @Immutable char @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java:[79,30] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Collections.max + unsatisfiable constraint: @Immutable Character <: @Mutable Object + @Immutable Character <: use of T from Collections.max(map.keySet()) + From complementary bound.: @Immutable Character <= inference type: ? extends T + @Mutable Set<@Immutable Character> <: inference type: java.util.Collection + @Mutable Set<@Immutable Character> -> inference type: java.util.Collection + map.keySet() -> inference type: java.util.Collection + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EnumHashBiMap.java:[88,8] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter forward of AbstractBiMap constructor. + found : @Mutable EnumMap>, V extends @Immutable Object> + required: @ReceiverDependentMutable Map, V extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EnumHashBiMap.java:[89,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backward of AbstractBiMap constructor. + found : @Mutable HashMap> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EnumHashBiMap.java:[131,27] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Serialization.writeMap. + found : @ReceiverDependentMutable EnumHashBiMap, V extends @Immutable Object> + required: @Mutable Map, V extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EnumHashBiMap.java:[138,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable EnumHashBiMap, V extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EnumHashBiMap.java:[140,8] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter forward of AbstractBiMap.setDelegates. + found : @Mutable EnumMap>, V extends @Immutable Object> + required: @ReceiverDependentMutable Map, V extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EnumHashBiMap.java:[140,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backward of AbstractBiMap.setDelegates. + found : @Mutable HashMap>> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EnumHashBiMap.java:[141,30] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Serialization.populateMap. + found : @ReceiverDependentMutable EnumHashBiMap, V extends @Immutable Object> + required: @Mutable Map, V extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[255,39] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PolyMutable AbstractBiMap.@Mutable KeySet + required: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[263,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Set + method return type: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[307,41] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PolyMutable AbstractBiMap.@Mutable ValueSet + required: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[313,48] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set + required: @ReceiverDependentMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[328,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Object @ReceiverDependentMutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[334,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of ForwardingCollection.standardToArray. + found : T extends @Readonly Object @Mutable [] + required: T extends @Readonly Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[351,41] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PolyMutable AbstractBiMap.@Mutable EntrySet + required: @PolyMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[385,60] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to entrySet() not allowed on the given receiver. + found : @PICOLost Map + required: @PICOLost Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[385,71] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@PICOLost Entry> + required: @Readonly Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[416,57] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set<@Mutable Entry> + required: @ReceiverDependentMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[420,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable Set<@Mutable Entry> + method return type: @Mutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[438,26] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[466,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Object @ReceiverDependentMutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[472,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of ForwardingCollection.standardToArray. + found : T extends @Readonly Object @Mutable [] + required: T extends @Readonly Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[538,17] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter inverse of AbstractBiMap.setInverse. + found : @Mutable AbstractBiMap + required: @ReceiverDependentMutable AbstractBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/AbstractBiMap.java:[543,30] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable BiMap + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java:[37,77] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of ImmutableListMultimap constructor. + found : @Immutable ImmutableMap<@Immutable Object, @Immutable ImmutableList<@Readonly Object>> + required: @Immutable ImmutableMap<@Immutable Object, @Immutable ImmutableList<@Immutable Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingList.java:[226,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter list of Lists.listIteratorImpl. + found : @Readonly ForwardingList + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingList.java:[237,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable List + method return type: @PolyMutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingList.java:[237,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter list of Lists.subListImpl. + found : @PolyMutable ForwardingList + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[214,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter initialContents of Builder.create. + found : @Immutable Set + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[599,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[602,21] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[645,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[666,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[667,29] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[670,21] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[691,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[692,26] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[711,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[712,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[728,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[835,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter target of QueueIterator.removeExact. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MinMaxPriorityQueue.java:[835,45] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: E extends @Readonly Object <: @Mutable Object + use of T from requireNonNull(lastFromForgetMeNot) <: @Mutable Object + From complementary bound.: use of T from requireNonNull(lastFromForgetMeNot) -> @Mutable Object + From: Constraint between method call type and target type for method call:requireNonNull(lastFromForgetMeNot) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableMapKeySet.java:[94,23] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSet + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[102,79] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter R of TreeBasedTable. + found : R extends @Mutable Comparable + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[102,82] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C of TreeBasedTable. + found : C extends @Mutable Comparable + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[103,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for TreeBasedTable constructor + unsatisfiable constraint: R extends @Mutable Comparable <: @Immutable Object + use of R from new TreeBasedTable<>(Ordering.natural(), Ordering.natural()) = R extends @Mutable Comparable + From complementary bound.: use of R from new TreeBasedTable<>(Ordering.natural(), Ordering.natural()) <= R extends @Mutable Comparable + inference type: com.google.common.collect.TreeBasedTable <: @Mutable TreeBasedTable, C extends @Mutable Comparable, V extends @Readonly Object> + inference type: com.google.common.collect.TreeBasedTable -> @Mutable TreeBasedTable, C extends @Mutable Comparable, V extends @Readonly Object> + From: Constraint between method call type and target type for method call:new TreeBasedTable<>(Ordering.natural(), Ordering.natural()) + C extends @Mutable Comparable <: @Immutable Object + use of C from new TreeBasedTable<>(Ordering.natural(), Ordering.natural()) = C extends @Mutable Comparable + From complementary bound.: use of C from new TreeBasedTable<>(Ordering.natural(), Ordering.natural()) <= C extends @Mutable Comparable + inference type: com.google.common.collect.TreeBasedTable <: @Mutable TreeBasedTable, C extends @Mutable Comparable, V extends @Readonly Object> + inference type: com.google.common.collect.TreeBasedTable -> @Mutable TreeBasedTable, C extends @Mutable Comparable, V extends @Readonly Object> + From: Constraint between method call type and target type for method call:new TreeBasedTable<>(Ordering.natural(), Ordering.natural()) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[132,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Comparator + required: @ReceiverDependentMutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[162,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Comparator + method return type: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[196,62] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of TreeRow.compare. + found : C extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[196,74] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter b of TreeRow.compare. + found : C extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[201,37] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of SortedKeySet constructor. + found : @Mutable TreeBasedTable.@ReceiverDependentMutable TreeRow + required: @Mutable SortedMap<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) C extends @Immutable Object, V extends @Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[218,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of TreeRow.compare. + found : C extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[218,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter b of TreeRow.compare. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[219,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of TreeRow.compare. + found : C extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[219,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter b of TreeRow.compare. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[246,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Map" to "@Mutable SortedMap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[255,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Map" to "@Mutable SortedMap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[263,17] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable TreeBasedTable.@ReceiverDependentMutable TreeRow +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[263,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable SortedMap + required: @ReceiverDependentMutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[279,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable SortedMap + method return type: @Mutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[289,17] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable TreeBasedTable.@ReceiverDependentMutable TreeRow +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[290,22] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable TreeBasedTable.@ReceiverDependentMutable TreeRow +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[327,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromIterable of Iterables.transform. + found : @ReceiverDependentMutable Collection<@Mutable Map> + required: @Mutable Iterable<@Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeBasedTable.java:[337,30] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Immutable Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardRowSortedTable.java:[64,10] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backingMap of StandardTable constructor. + found : @Mutable SortedMap> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardRowSortedTable.java:[64,22] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter factory of StandardTable constructor. + found : @Mutable Supplier> + required: @ReceiverDependentMutable Supplier> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardRowSortedTable.java:[68,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Map>" to "@Mutable SortedMap>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardRowSortedTable.java:[90,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Map>" to "@Mutable SortedMap>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[98,102] [[immutability, pico, piconoinit, allcheckers]:type.anno.before.decl.anno] write type annotations [@Readonly] immediately before type, after declaration annotation @CheckForNull +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[102,42] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to values() not allowed on the given receiver. + found : @PICOLost Map> + required: @PICOLost Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[134,42] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to values() not allowed on the given receiver. + found : @PICOLost Map> + required: @PICOLost Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[257,84] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@Mutable Entry>> + required: @ReceiverDependentMutable Iterator<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[259,76] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@Mutable Entry> + required: @ReceiverDependentMutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[287,33] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Cell + method return type: @Mutable Cell +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[312,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator<@Immutable Cell> + method return type: @Mutable Spliterator<@Mutable Cell> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[312,38] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CollectSpliterators.flatMap + unsatisfiable constraint: @PICOLost Entry> <: @Mutable Entry> + @Mutable Entry> = use of InElementT from CollectSpliterators.flatMap(backingMap.entrySet().spliterator(), (Entry> rowEntry)->CollectSpliterators.map(rowEntry.getValue().entrySet().spliterator(), (Entry columnEntry)->Tables.immutableCell(rowEntry.getKey(), columnEntry.getKey(), columnEntry.getValue())), Spliterator.DISTINCT | Spliterator.SIZED, size()) + From complementary bound.: (Entry> rowEntry)->CollectSpliterators.map(rowEntry.getValue().entrySet().spliterator(), (Entry columnEntry)->Tables.immutableCell(rowEntry.getKey(), columnEntry.getKey(), columnEntry.getValue())) -> inference type: java.util.function.Function> + From: Argument constraint + @Immutable Cell <: @Mutable Cell + use of OutElementT from CollectSpliterators.map(rowEntry.getValue().entrySet().spliterator(), (Entry columnEntry)->Tables.immutableCell(rowEntry.getKey(), columnEntry.getKey(), columnEntry.getValue())) <: @Mutable Cell + From complementary bound.: use of OutElementT from CollectSpliterators.flatMap(backingMap.entrySet().spliterator(), (Entry> rowEntry)->CollectSpliterators.map(rowEntry.getValue().entrySet().spliterator(), (Entry columnEntry)->Tables.immutableCell(rowEntry.getKey(), columnEntry.getKey(), columnEntry.getValue())), Spliterator.DISTINCT | Spliterator.SIZED, size()) <: @Mutable Cell + From complementary bound.: use of OutElementT from CollectSpliterators.flatMap(backingMap.entrySet().spliterator(), (Entry> rowEntry)->CollectSpliterators.map(rowEntry.getValue().entrySet().spliterator(), (Entry columnEntry)->Tables.immutableCell(rowEntry.getKey(), columnEntry.getKey(), columnEntry.getValue())), Spliterator.DISTINCT | Spliterator.SIZED, size()) <= @Mutable Cell + inference type: java.util.Spliterator <: @Mutable Spliterator<@Mutable Cell> + inference type: java.util.Spliterator -> @Mutable Spliterator<@Mutable Cell> + From: Constraint between method call type and target type for method call:CollectSpliterators.flatMap(backingMap.entrySet().spliterator(), (Entry> rowEntry)->CollectSpliterators.map(rowEntry.getValue().entrySet().spliterator(), (Entry columnEntry)->Tables.immutableCell(rowEntry.getKey(), columnEntry.getKey(), columnEntry.getValue())), Spliterator.DISTINCT | Spliterator.SIZED, size()) + @Immutable Cell <: @Mutable Cell +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[341,22] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable StandardTable.@ReceiverDependentMutable Row +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[341,44] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Map + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[355,22] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable StandardTable.@ReceiverDependentMutable Row +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[378,32] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to put(K,V) not allowed on the given receiver. + found : @ReceiverDependentMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[390,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Maps.safeRemove. + found : @ReceiverDependentMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[399,27] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[416,78] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@ReceiverDependentMutable Entry> + required: @Readonly Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[442,36] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CollectSpliterators.map + unsatisfiable constraint: @ReceiverDependentMutable Entry <: @Mutable Entry + use of InElementT from CollectSpliterators.map(backingRowMap.entrySet().spliterator(), this::wrapEntry) <: @Mutable Entry + From complementary bound.: this::wrapEntry -> inference type: java.util.function.Function + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[516,64] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter input of Predicate.apply. + found : @Immutable Entry + required: capture#0311 extends @Readonly Object super @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[563,30] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[572,30] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[706,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[706,45] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @ReceiverDependentMutable StandardTable.@Mutable ColumnKeySet + required: @ReceiverDependentMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[792,38] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : capture#0316 extends @Mutable Map + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[793,72] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@Mutable Map> + required: @ReceiverDependentMutable Iterator<@Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[794,65] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable UnmodifiableIterator<@Mutable Entry> + required: @ReceiverDependentMutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[801,48] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @ReceiverDependentMutable Iterator<@Mutable Entry> + required: @Mutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[803,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to put(K,V) not allowed on the given receiver. + found : @ReceiverDependentMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[807,24] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Mutable StandardTable.@ReceiverDependentMutable ColumnKeyIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[807,42] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @ReceiverDependentMutable Iterator<@Mutable Map> + required: @Mutable Iterator<@Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[807,64] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator<@Mutable Entry> + required: @ReceiverDependentMutable Iterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[809,26] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to endOfData() not allowed on the given receiver. + found : @Mutable StandardTable.@ReceiverDependentMutable ColumnKeyIterator + required: @Mutable AbstractIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[832,51] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Map> + required: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[853,36] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "R [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[889,30] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[900,30] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[916,42] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PolyMutable StandardTable.@Mutable ColumnMap + required: @Mutable StandardTable.@PolyMutable ColumnMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[929,42] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "C [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[995,21] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter obj of ColumnMapEntrySet.contains. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/StandardTable.java:[996,30] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java:[56,19] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to delegate() not allowed on the given receiver. + found : @Readonly ForwardingSortedSetMultimap + required: @PICOLost ForwardingSortedSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSetMultimap.java:[63,31] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingSetMultimap.java:[69,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/primitives/UnsignedLongs.java:[170,36] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable LexicographicalComparator + method return type: @Mutable Comparator<@Immutable long @Mutable []> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/primitives/UnsignedLongs.java:[528,24] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of String constructor. + found : @Immutable char @Mutable [] + required: @Immutable char @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[86,30] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[96,41] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PolyMutable TreeRangeSet>.@Mutable AsRanges + required: @PolyMutable Set<@Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[96,79] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of AsRanges constructor. + found : @PolyMutable Collection<@Immutable Range>> + required: @Mutable Collection<@Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[103,36] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PolyMutable TreeRangeSet>.@Mutable AsRanges + required: @PolyMutable Set<@Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[103,90] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of AsRanges constructor. + found : @PolyMutable Collection<@Immutable Range>> + required: @Mutable Collection<@Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[178,81] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to firstEntry() not allowed on the given receiver. + found : @PICOLost NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @PICOLost NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[179,79] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to lastEntry() not allowed on the given receiver. + found : @PICOLost NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @PICOLost NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[187,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from Range.create(firstEntry.getValue().lowerBound, lastEntry.getValue().upperBound) + From complementary bound.: C extends @Readonly Comparable <= use of C from Range.create(firstEntry.getValue().lowerBound, lastEntry.getValue().upperBound) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + firstEntry.getValue().lowerBound -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[232,53] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable SortedMap<@Immutable Cut>, @Immutable Range>> + required: @Mutable Map<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[234,47] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from Range.create(lbToAdd, ubToAdd) + From complementary bound.: C extends @Readonly Comparable <= use of C from Range.create(lbToAdd, ubToAdd) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + lbToAdd -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[258,26] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from Range.create(rangeToRemove.upperBound, rangeBelowLB.upperBound) + From complementary bound.: C extends @Readonly Comparable <= use of C from Range.create(rangeToRemove.upperBound, rangeBelowLB.upperBound) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + rangeToRemove.upperBound -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[261,24] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from Range.create(rangeBelowLB.lowerBound, rangeToRemove.lowerBound) + From complementary bound.: C extends @Readonly Comparable <= use of C from Range.create(rangeBelowLB.lowerBound, rangeToRemove.lowerBound) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + rangeBelowLB.lowerBound -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[273,24] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from Range.create(rangeToRemove.upperBound, rangeBelowUB.upperBound) + From complementary bound.: C extends @Readonly Comparable <= use of C from Range.create(rangeToRemove.upperBound, rangeBelowUB.upperBound) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + rangeToRemove.upperBound -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[277,87] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to clear() not allowed on the given receiver. + found : @ReceiverDependentMutable SortedMap<@Immutable Cut>, @Immutable Range>> + required: @Mutable Map<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[282,31] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove(java.lang.Object) not allowed on the given receiver. + found : @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @Mutable Map<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[284,28] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to put(K,V) not allowed on the given receiver. + found : @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @Mutable Map<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[294,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable RangeSet> + method return type: @Mutable RangeSet> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[294,43] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @PolyMutable TreeRangeSet>.@Mutable Complement + required: @PolyMutable RangeSet> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[310,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[311,39] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.all + unsatisfiable constraint: @Immutable Cut> <: @Mutable Comparable + use of C from Range.all() = @Immutable Cut> + From complementary bound.: use of C from Range.all() <= @Immutable Cut> + inference type: com.google.common.collect.Range <: @Immutable Range<@Immutable Cut>> + inference type: com.google.common.collect.Range -> @Immutable Range<@Immutable Cut>> + From: Constraint between method call type and target type for method call:Range.all() +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[316,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[322,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter rangesByLowerBound of RangesByUpperBound constructor. + found : @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[324,36] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSortedMap<@Immutable Cut>, @Immutable Range>> + method return type: @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[332,21] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.range + unsatisfiable constraint: @Immutable Cut> <: @Mutable Comparable + @Immutable Cut> <: use of C from Range.range(fromKey, BoundType.forBoolean(fromInclusive), toKey, BoundType.forBoolean(toInclusive)) + From complementary bound.: @Immutable Cut> -> use of C from Range.range(fromKey, BoundType.forBoolean(fromInclusive), toKey, BoundType.forBoolean(toInclusive)) + fromKey -> use of C from Range.range(fromKey, BoundType.forBoolean(fromInclusive), toKey, BoundType.forBoolean(toInclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[339,30] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.upTo + unsatisfiable constraint: @Immutable Cut> <: @Mutable Comparable + @Immutable Cut> <: use of C from Range.upTo(toKey, BoundType.forBoolean(inclusive)) + From complementary bound.: @Immutable Cut> -> use of C from Range.upTo(toKey, BoundType.forBoolean(inclusive)) + toKey -> use of C from Range.upTo(toKey, BoundType.forBoolean(inclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[344,32] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.downTo + unsatisfiable constraint: @Immutable Cut> <: @Mutable Comparable + @Immutable Cut> <: use of C from Range.downTo(fromKey, BoundType.forBoolean(inclusive)) + From complementary bound.: @Immutable Cut> -> use of C from Range.downTo(fromKey, BoundType.forBoolean(inclusive)) + fromKey -> use of C from Range.downTo(fromKey, BoundType.forBoolean(inclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[413,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry<@Immutable Cut>, @Immutable Range>> + method return type: @Mutable Entry<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[445,14] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry<@Immutable Cut>, @Immutable Range>> + method return type: @Mutable Entry<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[481,49] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C extends @Mutable Comparable of Range.all. + found : @Immutable Cut> + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[486,40] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[487,40] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable RangesByUpperBound> + required: @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[493,36] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSortedMap<@Immutable Cut>, @Immutable Range>> + method return type: @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[496,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter positiveRangesByLowerBound of ComplementRangesByLowerBound constructor. + found : @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[504,21] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.range + unsatisfiable constraint: @Immutable Cut> <: @Mutable Comparable + @Immutable Cut> <: use of C from Range.range(fromKey, BoundType.forBoolean(fromInclusive), toKey, BoundType.forBoolean(toInclusive)) + From complementary bound.: @Immutable Cut> -> use of C from Range.range(fromKey, BoundType.forBoolean(fromInclusive), toKey, BoundType.forBoolean(toInclusive)) + fromKey -> use of C from Range.range(fromKey, BoundType.forBoolean(fromInclusive), toKey, BoundType.forBoolean(toInclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[511,30] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.upTo + unsatisfiable constraint: @Immutable Cut> <: @Mutable Comparable + @Immutable Cut> <: use of C from Range.upTo(toKey, BoundType.forBoolean(inclusive)) + From complementary bound.: @Immutable Cut> -> use of C from Range.upTo(toKey, BoundType.forBoolean(inclusive)) + toKey -> use of C from Range.upTo(toKey, BoundType.forBoolean(inclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[516,32] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.downTo + unsatisfiable constraint: @Immutable Cut> <: @Mutable Comparable + @Immutable Cut> <: use of C from Range.downTo(fromKey, BoundType.forBoolean(inclusive)) + From complementary bound.: @Immutable Cut> -> use of C from Range.downTo(fromKey, BoundType.forBoolean(inclusive)) + fromKey -> use of C from Range.downTo(fromKey, BoundType.forBoolean(inclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[554,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@Mutable Entry<@Immutable Cut>, @Immutable Range>>> + method return type: @Mutable Iterator<@Mutable Entry<@Immutable Cut>, @Immutable Range>>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[569,40] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from Range.create(nextComplementRangeLowerBound, positiveRange.lowerBound) + From complementary bound.: C extends @Readonly Comparable <= use of C from Range.create(nextComplementRangeLowerBound, positiveRange.lowerBound) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + nextComplementRangeLowerBound -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[572,40] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from Range.create(nextComplementRangeLowerBound, Cut.aboveAll()) + From complementary bound.: C extends @Readonly Comparable <= use of C from Range.create(nextComplementRangeLowerBound, Cut.aboveAll()) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + nextComplementRangeLowerBound -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[575,36] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry<@Immutable Cut>, @Immutable Range>> + method return type: @Mutable Entry<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[612,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@Mutable Entry<@Immutable Cut>, @Immutable Range>>> + method return type: @Mutable Iterator<@Mutable Entry<@Immutable Cut>, @Immutable Range>>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[628,28] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from Range.create(positiveRange.upperBound, nextComplementRangeUpperBound) + From complementary bound.: C extends @Readonly Comparable <= use of C from Range.create(positiveRange.upperBound, nextComplementRangeUpperBound) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + positiveRange.upperBound -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[631,40] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry<@Immutable Cut>, @Immutable Range>> + method return type: @Mutable Entry<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[634,49] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.create + unsatisfiable constraint: C extends @Readonly Comparable <: @Mutable Comparable + C extends @Readonly Comparable = use of C from Range.create(Cut.belowAll(), nextComplementRangeUpperBound) + From complementary bound.: C extends @Readonly Comparable <= use of C from Range.create(Cut.belowAll(), nextComplementRangeUpperBound) + @Immutable Cut> <: inference type: com.google.common.collect.Cut + @Immutable Cut> -> inference type: com.google.common.collect.Cut + Cut.belowAll() -> inference type: com.google.common.collect.Cut + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[636,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry<@Immutable Cut>, @Immutable Range>> + method return type: @Mutable Entry<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[724,44] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[724,44] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Preconditions.checkNotNull + unsatisfiable constraint: @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> <: @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> + use of T from checkNotNull(rangesByLowerBound) <: @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> + From complementary bound.: use of T from checkNotNull(rangesByLowerBound) -> @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> + From: Constraint between method call type and target type for method call:checkNotNull(rangesByLowerBound) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[725,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable RangesByUpperBound> + required: @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[730,36] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSortedMap<@Immutable Cut>, @Immutable Range>> + method return type: @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[733,64] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter rangesByLowerBound of SubRangeSetRangesByLowerBound constructor. + found : @ReceiverDependentMutable NavigableMap<@Immutable Cut>, @Immutable Range>> + required: @Mutable NavigableMap<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[741,21] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.range + unsatisfiable constraint: @Immutable Cut> <: @Mutable Comparable + @Immutable Cut> <: use of C from Range.range(fromKey, BoundType.forBoolean(fromInclusive), toKey, BoundType.forBoolean(toInclusive)) + From complementary bound.: @Immutable Cut> -> use of C from Range.range(fromKey, BoundType.forBoolean(fromInclusive), toKey, BoundType.forBoolean(toInclusive)) + fromKey -> use of C from Range.range(fromKey, BoundType.forBoolean(fromInclusive), toKey, BoundType.forBoolean(toInclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[750,30] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.upTo + unsatisfiable constraint: @Immutable Cut> <: @Mutable Comparable + @Immutable Cut> <: use of C from Range.upTo(toKey, BoundType.forBoolean(inclusive)) + From complementary bound.: @Immutable Cut> -> use of C from Range.upTo(toKey, BoundType.forBoolean(inclusive)) + toKey -> use of C from Range.upTo(toKey, BoundType.forBoolean(inclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[755,32] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Range.downTo + unsatisfiable constraint: @Immutable Cut> <: @Mutable Comparable + @Immutable Cut> <: use of C from Range.downTo(fromKey, BoundType.forBoolean(inclusive)) + From complementary bound.: @Immutable Cut> -> use of C from Range.downTo(fromKey, BoundType.forBoolean(inclusive)) + fromKey -> use of C from Range.downTo(fromKey, BoundType.forBoolean(inclusive)) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[801,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@Mutable Entry<@Immutable Cut>, @Immutable Range>>> + method return type: @Mutable Iterator<@Mutable Entry<@Immutable Cut>, @Immutable Range>>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[805,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@Mutable Entry<@Immutable Cut>, @Immutable Range>>> + method return type: @Mutable Iterator<@Mutable Entry<@Immutable Cut>, @Immutable Range>>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[835,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry<@Immutable Cut>, @Immutable Range>> + method return type: @Mutable Entry<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[844,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable UnmodifiableIterator<@Mutable Entry<@Immutable Cut>, @Immutable Range>>> + method return type: @Mutable Iterator<@Mutable Entry<@Immutable Cut>, @Immutable Range>>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[870,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry<@Immutable Cut>, @Immutable Range>> + method return type: @Mutable Entry<@Immutable Cut>, @Immutable Range>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[886,30] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C extends @Mutable Comparable of Range.all. + found : C extends @Readonly Comparable + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[886,39] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly RangeSet> + method return type: @Mutable RangeSet> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[896,24] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter C extends @Mutable Comparable of Range.all. + found : @Immutable Cut> + required: @Mutable Comparable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[949,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable TreeRangeSet>.@ReceiverDependentMutable SubRangeSet + method return type: @Mutable RangeSet> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TreeRangeSet.java:[953,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableRangeSet> + method return type: @Mutable RangeSet> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[228,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[244,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[244,43] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object + required: @ReceiverDependentMutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[247,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[247,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[248,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[248,20] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Mutable Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[258,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Object" to "@Mutable Set" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[264,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for LinkedHashSet constructor + unsatisfiable constraint: E extends @Mutable Object <: @Immutable Object + use of E from new LinkedHashSet<>(tableSize, 1.0F) = E extends @Mutable Object + From complementary bound.: use of E from new LinkedHashSet<>(tableSize, 1.0F) <= E extends @Mutable Object + inference type: java.util.LinkedHashSet <: @Mutable Set + inference type: java.util.LinkedHashSet -> @Mutable Set + From: Constraint between method call type and target type for method call:new LinkedHashSet<>(tableSize, 1.0F) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[274,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[274,17] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set + required: @ReceiverDependentMutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[275,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[276,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[289,13] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[299,13] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[357,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[388,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[388,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[389,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[389,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Mutable Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[424,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[424,17] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object + required: @ReceiverDependentMutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[482,8] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[602,37] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator + method return type: @Mutable Spliterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[606,8] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator + method return type: @Mutable Spliterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[672,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[672,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set + required: @ReceiverDependentMutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[694,15] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[697,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[698,11] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[703,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[735,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Object + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[735,25] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @ReceiverDependentMutable Object <: @Mutable Object + use of T from requireNonNull(table) <: @Mutable Object + From complementary bound.: use of T from requireNonNull(table) -> @Mutable Object + From: Constraint between method call type and target type for method call:requireNonNull(table) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[739,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable int @ReceiverDependentMutable [] + method return type: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[739,25] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @Immutable int @ReceiverDependentMutable [] <: @Immutable int @Mutable [] + use of T from requireNonNull(entries) <: @Immutable int @Mutable [] + From complementary bound.: use of T from requireNonNull(entries) -> @Immutable int @Mutable [] + From: Constraint between method call type and target type for method call:requireNonNull(entries) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[743,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Object @ReceiverDependentMutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashSet.java:[743,25] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @Mutable Object @ReceiverDependentMutable [] <: @Mutable Object @Mutable [] + use of T from requireNonNull(elements) <: @Mutable Object @Mutable [] + From complementary bound.: use of T from requireNonNull(elements) -> @Mutable Object @Mutable [] + From: Constraint between method call type and target type for method call:requireNonNull(elements) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumSet.java:[51,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter iterable of Iterables.getOnlyElement. + found : @Immutable EnumSet + required: @Mutable Iterable<@Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumSet.java:[107,53] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable EnumSet> + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumSet.java:[125,45] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable EnumSet> + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumSet.java:[141,36] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ImmutableEnumSet> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumSet.java:[153,37] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of EnumSerializedForm constructor. + found : @Immutable EnumSet> + required: @Mutable EnumSet>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumSet.java:[168,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableEnumSet>> + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumSet.java:[168,51] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of ImmutableEnumSet constructor. + found : @Mutable EnumSet> + required: @Immutable EnumSet>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[125,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[126,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[132,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[132,17] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable long @Mutable [] + required: @Immutable long @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[145,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[176,17] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[182,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[211,23] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to moveLastEntry(int,int) not allowed on the given receiver. + found : @ReceiverDependentMutable CompactLinkedHashMap + required: @Mutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[224,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[224,25] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable long @Mutable [] + required: @Immutable long @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[243,39] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator<@ReceiverDependentMutable Entry> + method return type: @Mutable Spliterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[243,39] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Spliterators.spliterator + unsatisfiable constraint: @ReceiverDependentMutable Entry <: @Mutable Entry + use of T from Spliterators.spliterator(this, Spliterator.ORDERED | Spliterator.DISTINCT) <: @Mutable Entry + From complementary bound.: use of T from Spliterators.spliterator(this, Spliterator.ORDERED | Spliterator.DISTINCT) <= @Mutable Entry + inference type: java.util.Spliterator <: @Mutable Spliterator<@Mutable Entry> + inference type: java.util.Spliterator -> @Mutable Spliterator<@Mutable Entry> + From: Constraint between method call type and target type for method call:Spliterators.spliterator(this, Spliterator.ORDERED | Spliterator.DISTINCT) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[246,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable CompactLinkedHashMap.@Mutable EntrySetImpl + method return type: @Mutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[302,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[303,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[305,18] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of Arrays.fill. + found : @Immutable long @ReceiverDependentMutable [] + required: @Immutable long @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[316,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable long @ReceiverDependentMutable [] + method return type: @Immutable long @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashMap.java:[316,25] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @Immutable long @ReceiverDependentMutable [] <: @Immutable long @Mutable [] + use of T from requireNonNull(links) <: @Immutable long @Mutable [] + From complementary bound.: use of T from requireNonNull(links) -> @Immutable long @Mutable [] + From: Constraint between method call type and target type for method call:requireNonNull(links) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[107,17] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of CompactHashMap. + found : K extends @Mutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[108,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CompactHashMap constructor + unsatisfiable constraint: K extends @Mutable Object <: @Immutable Object + use of K from new CompactHashMap<>() = K extends @Mutable Object + From complementary bound.: use of K from new CompactHashMap<>() <= K extends @Mutable Object + inference type: com.google.common.collect.CompactHashMap <: @Mutable CompactHashMap + inference type: com.google.common.collect.CompactHashMap -> @Mutable CompactHashMap + From: Constraint between method call type and target type for method call:new CompactHashMap<>() +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[121,17] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of CompactHashMap. + found : K extends @Mutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[122,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CompactHashMap constructor + unsatisfiable constraint: K extends @Mutable Object <: @Immutable Object + use of K from new CompactHashMap<>(expectedSize) = K extends @Mutable Object + From complementary bound.: use of K from new CompactHashMap<>(expectedSize) <= K extends @Mutable Object + inference type: com.google.common.collect.CompactHashMap <: @Mutable CompactHashMap + inference type: com.google.common.collect.CompactHashMap -> @Mutable CompactHashMap + From: Constraint between method call type and target type for method call:new CompactHashMap<>(expectedSize) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[283,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[283,43] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object + required: @ReceiverDependentMutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[286,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[286,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[287,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[287,16] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Mutable Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[288,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[288,18] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Mutable Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[298,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Object" to "@Mutable Map" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[314,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[314,17] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Map + required: @ReceiverDependentMutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[315,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[316,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[317,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[387,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : V extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[419,15] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setKey(int,K) not allowed on the given receiver. + found : @ReceiverDependentMutable CompactHashMap + required: @Mutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[420,17] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setValue(int,V) not allowed on the given receiver. + found : @ReceiverDependentMutable CompactHashMap + required: @Mutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[441,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[441,32] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[442,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[442,29] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Mutable Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[443,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[443,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Mutable Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[488,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[488,17] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object + required: @ReceiverDependentMutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[546,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of CompactHashMap.removeHelper. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[562,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter keys of CompactHashing.remove. + found : @Mutable Object @ReceiverDependentMutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[570,17] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to moveLastEntry(int,int) not allowed on the given receiver. + found : @ReceiverDependentMutable CompactHashMap + required: @Mutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[574,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[696,16] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setValue(int,V) not allowed on the given receiver. + found : @ReceiverDependentMutable CompactHashMap + required: @Mutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[705,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Set<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> + method return type: @Mutable Set<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[705,45] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[705,59] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set + required: @ReceiverDependentMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[725,10] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @Mutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[761,39] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator + method return type: @Mutable Spliterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[765,10] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator + method return type: @Mutable Spliterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[789,19] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter T of Itr. + found : K extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[815,34] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Set<@Mutable Entry<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Readonly Object>> + method return type: @Mutable Set<@Mutable Entry<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object, V extends @Readonly Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[815,49] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[815,65] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set<@Mutable Entry> + required: @ReceiverDependentMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[819,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable CompactHashMap.@Mutable EntrySetView + method return type: @Mutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[838,10] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator<@Mutable Entry> + method return type: @Mutable Spliterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[839,39] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CollectSpliterators.indexed + unsatisfiable constraint: @Mutable CompactHashMap.@Mutable MapEntry <: @Mutable Entry + use of T from CollectSpliterators.indexed(size, Spliterator.DISTINCT | Spliterator.ORDERED, MapEntry::new) <: @Mutable Entry + From complementary bound.: use of T from CollectSpliterators.indexed(size, Spliterator.DISTINCT | Spliterator.ORDERED, MapEntry::new) <= @Mutable Entry + inference type: java.util.Spliterator <: @Mutable Spliterator<@Mutable Entry> + inference type: java.util.Spliterator -> @Mutable Spliterator<@Mutable Entry> + From: Constraint between method call type and target type for method call:CollectSpliterators.indexed(size, Spliterator.DISTINCT | Spliterator.ORDERED, MapEntry::new) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[850,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of CompactHashMap.indexOf. + found : @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[869,28] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of CompactHashing.remove. + found : @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[870,30] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter value of CompactHashing.remove. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[923,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of CompactHashMap.indexOf. + found : K extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[998,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Collection + method return type: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[998,45] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[998,59] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Collection + required: @ReceiverDependentMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1008,26] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Values constructor. + found : @Mutable CompactHashMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1032,39] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator + method return type: @Mutable Spliterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1036,10] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator + method return type: @Mutable Spliterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1047,10] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @Mutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1056,55] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : T extends @Readonly Object @Mutable [] + required: @Mutable Object @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1073,19] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter T of Itr. + found : V extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1094,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1094,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Map + required: @ReceiverDependentMutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1119,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1122,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of Arrays.fill. + found : @Mutable Object @ReceiverDependentMutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1123,31] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of Arrays.fill. + found : @Mutable Object @ReceiverDependentMutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1150,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1152,9] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to put(K,V) not allowed on the given receiver. + found : @ReceiverDependentMutable CompactHashMap + required: @Mutable CompactHashMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1169,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Object + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1169,25] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @ReceiverDependentMutable Object <: @Mutable Object + use of T from requireNonNull(table) <: @Mutable Object + From complementary bound.: use of T from requireNonNull(table) -> @Mutable Object + From: Constraint between method call type and target type for method call:requireNonNull(table) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1173,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable int @ReceiverDependentMutable [] + method return type: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1173,25] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @Immutable int @ReceiverDependentMutable [] <: @Immutable int @Mutable [] + use of T from requireNonNull(entries) <: @Immutable int @Mutable [] + From complementary bound.: use of T from requireNonNull(entries) -> @Immutable int @Mutable [] + From: Constraint between method call type and target type for method call:requireNonNull(entries) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1194,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1207,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : K extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactHashMap.java:[1211,25] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : V extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java:[45,10] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter encoded of TrieParser.parseTrie. + found : @Immutable String + required: @Mutable CharSequence +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java:[53,10] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter encoded of TrieParser.parseTrie. + found : @Immutable String + required: @Mutable CharSequence +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java:[62,10] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter encoded of TrieParser.parseTrie. + found : @Immutable String + required: @Mutable CharSequence +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EvictingQueue.java:[143,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @Mutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/Absent.java:[78,31] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Set<@org.checkerframework.checker.nullness.qual.NonNull T extends @Readonly Object> + method return type: @Mutable Set<@org.checkerframework.checker.nullness.qual.NonNull T extends @Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EnumMultiset.java:[148,13] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of EnumMultiset.checkIsE. + found : E extends @Immutable Enum + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EnumMultiset.java:[151,19] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of EnumMultiset.count. + found : E extends @Immutable Enum + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/EnumMultiset.java:[197,13] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of EnumMultiset.checkIsE. + found : E extends @Immutable Enum + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Interners.java:[86,13] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for InternerImpl constructor + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + use of E from new InternerImpl<>(mapMaker) = E extends @Readonly Object + From complementary bound.: use of E from new InternerImpl<>(mapMaker) <= E extends @Readonly Object + inference type: com.google.common.collect.Interners.InternerImpl <: @Mutable Interner + inference type: com.google.common.collect.Interners.InternerImpl -> @Mutable Interner + From: Constraint between method call type and target type for method call:new InternerImpl<>(mapMaker) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Interners.java:[122,94] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter equivalence of MapMaker.keyEquivalence. + found : @Mutable Equivalence<@Readonly Object> + required: @Mutable Equivalence<@Mutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Interners.java:[130,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of MapMakerInternalMap.getEntry. + found : E extends @Immutable Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/FinalizableWeakReference.java:[42,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter q of WeakReference constructor. + found : @Mutable ReferenceQueue<@Mutable Object> + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/FinalizableReferenceQueue.java:[162,54] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter args of Method.invoke. + found : @Immutable Class<@Mutable FinalizableReference> + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[151,72] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of ImmutableSortedMap. + found : K extends @Mutable Comparable + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[152,13] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableSortedMap.of + unsatisfiable constraint: K extends @Mutable Comparable> <: @Immutable Object + K extends @Mutable Comparable> <: use of K from of(Ordering.natural(), k1, v1) + From complementary bound.: K extends @Mutable Comparable> -> use of K from of(Ordering.natural(), k1, v1) + k1 -> use of K from of(Ordering.natural(), k1, v1) + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[169,72] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of ImmutableSortedMap. + found : K extends @Mutable Comparable + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[171,22] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableSortedMap.fromEntries + unsatisfiable constraint: K extends @Mutable Comparable> <: @Immutable Object + K extends @Mutable Comparable> <: use of K from entryOf(k1, v1) + From complementary bound.: K extends @Mutable Comparable> -> use of K from entryOf(k1, v1) + k1 -> use of K from entryOf(k1, v1) + From: Argument constraint + K extends @Mutable Comparable> <: @Immutable Object + K extends @Mutable Comparable> <: use of K from entryOf(k2, v2) + From complementary bound.: K extends @Mutable Comparable> -> use of K from entryOf(k2, v2) + k2 -> use of K from entryOf(k2, v2) + From: Argument constraint + K extends @Mutable Comparable <: @Immutable Comparable> + use of K from fromEntries(entryOf(k1, v1), entryOf(k2, v2)) = K extends @Mutable Comparable + From complementary bound.: use of K from fromEntries(entryOf(k1, v1), entryOf(k2, v2)) <= K extends @Mutable Comparable + inference type: com.google.common.collect.ImmutableSortedMap <: @Immutable ImmutableSortedMap, V extends @Readonly Object> + inference type: com.google.common.collect.ImmutableSortedMap -> @Immutable ImmutableSortedMap, V extends @Readonly Object> + From: Constraint between method call type and target type for method call:fromEntries(entryOf(k1, v1), entryOf(k2, v2)) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[181,72] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of ImmutableSortedMap. + found : K extends @Mutable Comparable + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[183,22] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableSortedMap.fromEntries + unsatisfiable constraint: K extends @Mutable Comparable> <: @Immutable Object + K extends @Mutable Comparable> <: use of K from entryOf(k1, v1) + From complementary bound.: K extends @Mutable Comparable> -> use of K from entryOf(k1, v1) + k1 -> use of K from entryOf(k1, v1) + From: Argument constraint + K extends @Mutable Comparable> <: @Immutable Object + K extends @Mutable Comparable> <: use of K from entryOf(k2, v2) + From complementary bound.: K extends @Mutable Comparable> -> use of K from entryOf(k2, v2) + k2 -> use of K from entryOf(k2, v2) + From: Argument constraint + K extends @Mutable Comparable> <: @Immutable Object + K extends @Mutable Comparable> <: use of K from entryOf(k3, v3) + From complementary bound.: K extends @Mutable Comparable> -> use of K from entryOf(k3, v3) + k3 -> use of K from entryOf(k3, v3) + From: Argument constraint + K extends @Mutable Comparable <: @Immutable Comparable> + use of K from fromEntries(entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3)) = K extends @Mutable Comparable + From complementary bound.: use of K from fromEntries(entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3)) <= K extends @Mutable Comparable + inference type: com.google.common.collect.ImmutableSortedMap <: @Immutable ImmutableSortedMap, V extends @Readonly Object> + inference type: com.google.common.collect.ImmutableSortedMap -> @Immutable ImmutableSortedMap, V extends @Readonly Object> + From: Constraint between method call type and target type for method call:fromEntries(entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3)) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[193,72] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of ImmutableSortedMap. + found : K extends @Mutable Comparable + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[195,22] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableSortedMap.fromEntries + unsatisfiable constraint: K extends @Mutable Comparable> <: @Immutable Object + K extends @Mutable Comparable> <: use of K from entryOf(k1, v1) + From complementary bound.: K extends @Mutable Comparable> -> use of K from entryOf(k1, v1) + k1 -> use of K from entryOf(k1, v1) + From: Argument constraint + K extends @Mutable Comparable> <: @Immutable Object + K extends @Mutable Comparable> <: use of K from entryOf(k2, v2) + From complementary bound.: K extends @Mutable Comparable> -> use of K from entryOf(k2, v2) + k2 -> use of K from entryOf(k2, v2) + From: Argument constraint + K extends @Mutable Comparable> <: @Immutable Object + K extends @Mutable Comparable> <: use of K from entryOf(k3, v3) + From complementary bound.: K extends @Mutable Comparable> -> use of K from entryOf(k3, v3) + k3 -> use of K from entryOf(k3, v3) + From: Argument constraint + K extends @Mutable Comparable> <: @Immutable Object + K extends @Mutable Comparable> <: use of K from entryOf(k4, v4) + From complementary bound.: K extends @Mutable Comparable> -> use of K from entryOf(k4, v4) + k4 -> use of K from entryOf(k4, v4) + From: Argument constraint + K extends @Mutable Comparable <: @Immutable Comparable> + use of K from fromEntries(entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3), entryOf(k4, v4)) = K extends @Mutable Comparable + From complementary bound.: use of K from fromEntries(entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3), entryOf(k4, v4)) <= K extends @Mutable Comparable + inference type: com.google.common.collect.ImmutableSortedMap <: @Immutable ImmutableSortedMap, V extends @Readonly Object> + inference type: com.google.common.collect.ImmutableSortedMap -> @Immutable ImmutableSortedMap, V extends @Readonly Object> + From: Constraint between method call type and target type for method call:fromEntries(entryOf(k1, v1), entryOf(k2, v2), entryOf(k3, v3), entryOf(k4, v4)) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[496,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryArray of ImmutableSortedMap.fromEntries. + found : @Immutable Entry>, V extends @Readonly Object> @Mutable [] + required: @Mutable Entry, V extends @Readonly Object> @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[528,35] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Immutable Object @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[578,73] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of RegularImmutableList constructor. + found : @Immutable Object @Mutable [] + required: @Mutable Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[579,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of RegularImmutableList constructor. + found : @Readonly Object @Mutable [] + required: @Mutable Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[587,53] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Builder. + found : K extends @Mutable Comparable + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[588,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Builder constructor + unsatisfiable constraint: K extends @Mutable Comparable <: @Immutable Object + use of K from new Builder<>(Ordering.natural()) = K extends @Mutable Comparable + From complementary bound.: use of K from new Builder<>(Ordering.natural()) <= K extends @Mutable Comparable + inference type: com.google.common.collect.ImmutableSortedMap.Builder <: @Mutable Builder, V extends @Readonly Object> + inference type: com.google.common.collect.ImmutableSortedMap.Builder -> @Mutable Builder, V extends @Readonly Object> + From: Constraint between method call type and target type for method call:new Builder<>(Ordering.natural()) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[607,53] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Builder. + found : K extends @Mutable Comparable + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[608,11] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Builder constructor + unsatisfiable constraint: K extends @Mutable Comparable <: @Immutable Object + use of K from new Builder<>(Ordering.natural().reverse()) = K extends @Mutable Comparable + From complementary bound.: use of K from new Builder<>(Ordering.natural().reverse()) <= K extends @Mutable Comparable + inference type: com.google.common.collect.ImmutableSortedMap.Builder <: @Mutable Builder, V extends @Readonly Object> + inference type: com.google.common.collect.ImmutableSortedMap.Builder -> @Mutable Builder, V extends @Readonly Object> + From: Constraint between method call type and target type for method call:new Builder<>(Ordering.natural().reverse()) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[754,48] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryArray of ImmutableSortedMap.fromEntries. + found : @Immutable Entry @Mutable [] + required: @Mutable Entry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[849,15] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable ImmutableSortedMap.@Immutable EntrySet.@Readonly (@Immutable ImmutableSortedMap.@Immutable EntrySet this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[849,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly ImmutableList<@Mutable Entry> + method return type: @Immutable ImmutableList<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[852,19] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable SimpleImmutableEntry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableSortedMap.java:[859,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to size() not allowed on the given receiver. + found : @Immutable ImmutableSortedMap.@Immutable EntrySet.@Mutable + required: @Immutable ImmutableAsList<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[59,28] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of ImmutableMap. + found : @Mutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[60,6] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for RegularImmutableMap constructor + unsatisfiable constraint: @Mutable Object <: @Immutable Object + @Mutable Object <: use of K from new RegularImmutableMap<>((Entry[])ImmutableMap.EMPTY_ENTRY_ARRAY, null, 0) + From complementary bound.: @Mutable Object <= use of K from new RegularImmutableMap<>((Entry[])ImmutableMap.EMPTY_ENTRY_ARRAY, null, 0) + @Mutable Entry<@Mutable Object, @Mutable Object> <: inference type: java.util.Map.Entry + @Mutable Entry<@Mutable Object, @Mutable Object> @Mutable [] <: inference type: java.util.Map.Entry[] + @Mutable Entry<@Mutable Object, @Mutable Object> @Mutable [] -> inference type: java.util.Map.Entry[] + (Entry[])ImmutableMap.EMPTY_ENTRY_ARRAY -> inference type: java.util.Map.Entry[] + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[89,42] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryArray of RegularImmutableMap.fromEntryArray. + found : @Immutable Entry @Mutable [] + required: @Mutable Entry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[110,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryArray of JdkBackedImmutableMap.create. + found : @Mutable Entry @Mutable [] + required: @Immutable Entry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[124,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly Entry @Mutable [] + required: @Mutable Entry @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[133,25] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of IdentityHashMap. + found : @Mutable Entry + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[157,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for IdentityHashMap constructor + unsatisfiable constraint: @Mutable Entry <: @Immutable Object + use of K from new IdentityHashMap<>() = @Mutable Entry + From complementary bound.: use of K from new IdentityHashMap<>() <= @Mutable Entry + inference type: java.util.IdentityHashMap <: @Readonly IdentityHashMap<@Mutable Entry, @Immutable Boolean> + inference type: java.util.IdentityHashMap -> @Readonly IdentityHashMap<@Mutable Entry, @Immutable Boolean> + From: Constraint between method call type and target type for method call:new IdentityHashMap<>() +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[159,23] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of IdentityHashMap.put. + found : @Immutable ImmutableMapEntry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[167,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable ImmutableMapEntry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[171,85] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter duplicates of RegularImmutableMap.removeDuplicates. + found : @Mutable IdentityHashMap<@Mutable Entry, @Immutable Boolean> + required: @Mutable IdentityHashMap<@Immutable Entry, @Immutable Boolean> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[195,47] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable ImmutableMapEntry @Mutable [] + required: @Mutable Entry @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[202,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter key of IdentityHashMap.put. + found : @Mutable Entry + required: @Immutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[226,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Entry @Mutable [] + required: @Mutable Entry @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[227,17] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable ImmutableMapEntry @Mutable [] + required: @Immutable ImmutableMapEntry @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[270,20] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter keyTable of RegularImmutableMap.get. + found : @Immutable ImmutableMapEntry @Immutable [] + required: @Immutable ImmutableMapEntry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[321,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularEntrySet constructor. + found : @Mutable Entry @Immutable [] + required: @Immutable Entry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableMap.java:[369,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSet + method return type: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/primitives/UnsignedInts.java:[210,36] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable LexicographicalComparator + method return type: @Mutable Comparator<@Immutable int @Mutable []> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[67,14] [[immutability, pico, piconoinit, allcheckers]:methodref.receiver.invalid] Incompatible receiver type + found : @Mutable Builder<@Mutable Comparable> + required: @Mutable Builder<@Readonly Comparable> + Consequence: method in @Mutable Builder> + @Mutable Builder<@Mutable Comparable> add(@Mutable Builder<@Mutable Comparable> this, @Immutable Range<@Mutable Comparable> p0) + is not a valid method reference for method in @Mutable BiConsumer<@Mutable Builder<@Readonly Comparable>, @Immutable Range<@Mutable Comparable>> + void accept(@Mutable BiConsumer<@Mutable Builder<@Readonly Comparable>, @Immutable Range<@Mutable Comparable>> this, @Mutable Builder<@Readonly Comparable> p0, @Immutable Range<@Mutable Comparable> p1) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[69,14] [[immutability, pico, piconoinit, allcheckers]:methodref.receiver.invalid] Incompatible receiver type + found : @Mutable Builder<@Mutable Comparable> + required: @Mutable Builder<@Readonly Comparable> + Consequence: method in @Mutable Builder> + @Immutable ImmutableRangeSet<@Mutable Comparable> build(@Mutable Builder<@Mutable Comparable> this) + is not a valid method reference for method in @Mutable Function<@Mutable Builder<@Readonly Comparable>, @Immutable ImmutableRangeSet<@Mutable Comparable>> + @Immutable ImmutableRangeSet<@Mutable Comparable> apply(@ReceiverDependentMutable Function<@Mutable Builder<@Readonly Comparable>, @Immutable ImmutableRangeSet<@Mutable Comparable>> this, @Mutable Builder<@Readonly Comparable> p0) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[133,81] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of ImmutableEnumSet.asImmutable. + found : @Mutable EnumSet> + required: @Immutable EnumSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[150,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Collector.of + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + use of E from LinkedHashMultiset::create = E extends @Readonly Object + From complementary bound.: use of E from LinkedHashMultiset::create <= E extends @Readonly Object + inference type: com.google.common.collect.LinkedHashMultiset <: @Mutable Multiset + inference type: com.google.common.collect.LinkedHashMultiset <: use of A from Collector.of(LinkedHashMultiset::create, (multiset,t)->multiset.add(checkNotNull(elementFunction.apply(t)), countFunction.applyAsInt(t)), (multiset1,multiset2)->{ + multiset1.addAll(multiset2); + return multiset1; + }, (Multiset multiset)->ImmutableMultiset.copyFromEntries(multiset.entrySet())) + From complementary bound.: inference type: com.google.common.collect.LinkedHashMultiset -> use of A from Collector.of(LinkedHashMultiset::create, (multiset,t)->multiset.add(checkNotNull(elementFunction.apply(t)), countFunction.applyAsInt(t)), (multiset1,multiset2)->{ + multiset1.addAll(multiset2); + return multiset1; + }, (Multiset multiset)->ImmutableMultiset.copyFromEntries(multiset.entrySet())) + From: Constraint between method call type and target type for method call:LinkedHashMultiset::create +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[171,25] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to add(E,int) not allowed on the given receiver. + found : M extends @Readonly Multiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[173,20] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to addAll(java.util.Collection) not allowed on the given receiver. + found : M extends @Readonly Multiset + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[241,129] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V of ImmutableBiMap. + found : V extends @Mutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[248,9] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V of Builder. + found : V extends @Mutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[249,8] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Builder.combine + unsatisfiable constraint: V extends @Mutable Object <: @Immutable Object + V extends @Mutable Object = use of V from ImmutableBiMap.Builder::combine + From complementary bound.: V extends @Mutable Object <= use of V from ImmutableBiMap.Builder::combine + @Mutable Builder <: inference type: com.google.common.collect.ImmutableBiMap.Builder + @Mutable Builder -> inference type: com.google.common.collect.ImmutableBiMap.Builder + From: Method reference: ImmutableBiMap.Builder::combine, constraint against arguments, index 0. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[250,8] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Builder.build + unsatisfiable constraint: V extends @Mutable Object <: @Immutable Object + V extends @Mutable Object = use of V from ImmutableBiMap.Builder::build + From complementary bound.: V extends @Mutable Object <= use of V from ImmutableBiMap.Builder::build + @Mutable Builder <: inference type: com.google.common.collect.ImmutableBiMap.Builder + @Mutable Builder -> inference type: com.google.common.collect.ImmutableBiMap.Builder + From: Method reference: ImmutableBiMap.Builder::build, constraint against arguments, index 0. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[335,27] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableMap super @PICOBottom NullType ], V [ extends @Readonly Object super @Readonly NullType ]> + method return type: @Immutable ImmutableMap super @PICOBottom NullType ], V [ extends @Readonly Object super @PICOBottom NullType ]> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[335,100] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of ImmutableEnumMap.asImmutable. + found : @Mutable EnumMap, V extends @Readonly Object> + required: @Mutable EnumMap, V extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[356,47] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V of ImmutableListMultimap. + found : V extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[363,9] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V of Builder. + found : V extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[364,8] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Builder.combine + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object = use of V from ImmutableListMultimap.Builder::combine + From complementary bound.: V extends @Readonly Object <= use of V from ImmutableListMultimap.Builder::combine + @Mutable Builder <: inference type: com.google.common.collect.ImmutableListMultimap.Builder + @Mutable Builder -> inference type: com.google.common.collect.ImmutableListMultimap.Builder + From: Method reference: ImmutableListMultimap.Builder::combine, constraint against arguments, index 0. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[365,8] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Builder.build + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object = use of V from ImmutableListMultimap.Builder::build + From complementary bound.: V extends @Readonly Object <= use of V from ImmutableListMultimap.Builder::build + @Mutable Builder <: inference type: com.google.common.collect.ImmutableListMultimap.Builder + @Mutable Builder -> inference type: com.google.common.collect.ImmutableListMultimap.Builder + From: Method reference: ImmutableListMultimap.Builder::build, constraint against arguments, index 0. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[369,47] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V of ImmutableListMultimap. + found : V extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[379,8] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableListMultimap.copyOf + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object <: use of V from ImmutableListMultimap::copyOf + From complementary bound.: V extends @Readonly Object <= inference type: ? extends V + @Mutable ListMultimap <: inference type: com.google.common.collect.Multimap + @Mutable ListMultimap -> inference type: com.google.common.collect.Multimap + From: Method reference: ImmutableListMultimap::copyOf, constraint against arguments, index 0. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[383,46] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V of ImmutableSetMultimap. + found : V extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[390,9] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V of Builder. + found : V extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[391,8] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Builder.combine + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object = use of V from ImmutableSetMultimap.Builder::combine + From complementary bound.: V extends @Readonly Object <= use of V from ImmutableSetMultimap.Builder::combine + @Mutable Builder <: inference type: com.google.common.collect.ImmutableSetMultimap.Builder + @Mutable Builder -> inference type: com.google.common.collect.ImmutableSetMultimap.Builder + From: Method reference: ImmutableSetMultimap.Builder::combine, constraint against arguments, index 0. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[392,8] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Builder.build + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object = use of V from ImmutableSetMultimap.Builder::build + From complementary bound.: V extends @Readonly Object <= use of V from ImmutableSetMultimap.Builder::build + @Mutable Builder <: inference type: com.google.common.collect.ImmutableSetMultimap.Builder + @Mutable Builder -> inference type: com.google.common.collect.ImmutableSetMultimap.Builder + From: Method reference: ImmutableSetMultimap.Builder::build, constraint against arguments, index 0. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[396,46] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V of ImmutableSetMultimap. + found : V extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectCollectors.java:[406,8] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableSetMultimap.copyOf + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object <: use of V from ImmutableSetMultimap::copyOf + From complementary bound.: V extends @Readonly Object <= inference type: ? extends V + @Mutable SetMultimap <: inference type: com.google.common.collect.Multimap + @Mutable SetMultimap -> inference type: com.google.common.collect.Multimap + From: Method reference: ImmutableSetMultimap::copyOf, constraint against arguments, index 0. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableBiMap.java:[73,45] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CollectCollectors.toImmutableBiMap + unsatisfiable constraint: V extends @Immutable Object <: @Mutable Object + capture#0325 extends V extends @Immutable Object <: use of V from CollectCollectors.toImmutableBiMap(keyFunction, valueFunction) + From complementary bound.: capture#0325 extends V extends @Immutable Object <= inference type: ? extends V + @Mutable Function <: inference type: java.util.function.Function + @Mutable Function -> inference type: java.util.function.Function + valueFunction -> inference type: java.util.function.Function + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableBiMap.java:[288,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularImmutableBiMap.fromEntries. + found : @Mutable Entry @Mutable [] + required: @Immutable Entry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableBiMap.java:[480,23] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Arrays.sort + unsatisfiable constraint: @Immutable Entry <: @Mutable Entry + use of T from Arrays.sort(entries, 0, size, Ordering.from(valueComparator).onResultOf(Maps.valueFunction())) <: use of F from Ordering.from(valueComparator).onResultOf(Maps.valueFunction()) + From complementary bound.: use of F from Ordering.from(valueComparator).onResultOf(Maps.valueFunction()) <= inference type: ? super T + inference type: com.google.common.collect.Ordering <: inference type: java.util.Comparator + inference type: com.google.common.collect.Ordering -> inference type: java.util.Comparator + From: Constraint between method call type and target type for method call:Ordering.from(valueComparator).onResultOf(Maps.valueFunction()) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableBiMap.java:[487,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryArray of RegularImmutableBiMap.fromEntryArray. + found : @Immutable Entry @Mutable [] + required: @Immutable Entry @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableBiMap.java:[521,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryArray of RegularImmutableBiMap.fromEntryArray. + found : @Immutable Entry @Mutable [] + required: @Immutable Entry @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableBiMap.java:[580,49] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularImmutableBiMap.fromEntries. + found : @Mutable Entry @Mutable [] + required: @Immutable Entry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java:[50,22] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java:[71,27] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Map + required: @Immutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java:[72,28] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Map + required: @Immutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java:[86,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable JdkBackedImmutableBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java:[89,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter forwardDelegate of JdkBackedImmutableBiMap constructor. + found : @Immutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java:[89,58] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backwardDelegate of JdkBackedImmutableBiMap constructor. + found : @Immutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java:[90,6] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable JdkBackedImmutableBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java:[101,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java:[123,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable RegularEntrySet + method return type: @Immutable ImmutableSet<@Immutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java:[123,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularEntrySet constructor. + found : @Immutable ImmutableList<@Mutable Entry> + required: @Immutable ImmutableList<@Immutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumMap.java:[57,20] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable EnumMap, V extends @Immutable Object> + required: @Immutable EnumMap, V extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumMap.java:[93,48] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable EnumMap, capture#0328 extends @Immutable Object> + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumMap.java:[100,41] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator<@Mutable Entry, V extends @Immutable Object>> + method return type: @Immutable UnmodifiableIterator<@Mutable Entry, V extends @Immutable Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumMap.java:[100,70] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryIterator of Maps.unmodifiableEntryIterator. + found : @Mutable Iterator<@Immutable Entry, V extends @Immutable Object>> + required: @Readonly Iterator<@Mutable Entry, V extends @Immutable Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumMap.java:[105,34] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator<@Readonly Entry, V extends @Immutable Object>> + method return type: @Mutable Spliterator<@Mutable Entry, V extends @Immutable Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumMap.java:[105,34] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for CollectSpliterators.map + unsatisfiable constraint: @Readonly Entry, V extends @Immutable Object> <: @Mutable Entry, V extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumMap.java:[121,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of EnumSerializedForm constructor. + found : @Immutable EnumMap, V extends @Immutable Object> + required: @Mutable EnumMap, V extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableEnumMap.java:[135,13] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for ImmutableEnumMap constructor + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + V extends @Readonly Object = use of V from new ImmutableEnumMap<>(delegate) + From complementary bound.: V extends @Readonly Object <= use of V from new ImmutableEnumMap<>(delegate) + @Mutable EnumMap, V extends @Readonly Object> <: inference type: java.util.EnumMap + @Mutable EnumMap, V extends @Readonly Object> -> inference type: java.util.EnumMap + delegate -> inference type: java.util.EnumMap + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Platform.java:[60,42] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Sets.newHashSetWithExpectedSize + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + use of E from Sets.newHashSetWithExpectedSize(expectedSize) = E extends @Readonly Object + From complementary bound.: use of E from Sets.newHashSetWithExpectedSize(expectedSize) <= E extends @Readonly Object + inference type: java.util.HashSet <: @Mutable Set + inference type: java.util.HashSet -> @Mutable Set + From: Constraint between method call type and target type for method call:Sets.newHashSetWithExpectedSize(expectedSize) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Platform.java:[73,48] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Sets.newLinkedHashSetWithExpectedSize + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + use of E from Sets.newLinkedHashSetWithExpectedSize(expectedSize) = E extends @Readonly Object + From complementary bound.: use of E from Sets.newLinkedHashSetWithExpectedSize(expectedSize) <= E extends @Readonly Object + inference type: java.util.LinkedHashSet <: @Mutable Set + inference type: java.util.LinkedHashSet -> @Mutable Set + From: Constraint between method call type and target type for method call:Sets.newLinkedHashSetWithExpectedSize(expectedSize) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Platform.java:[90,32] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Sets.newLinkedHashSet + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + use of E from Sets.newLinkedHashSet() = E extends @Readonly Object + From complementary bound.: use of E from Sets.newLinkedHashSet() <= E extends @Readonly Object + inference type: java.util.LinkedHashSet <: @Mutable Set + inference type: java.util.LinkedHashSet -> @Mutable Set + From: Constraint between method call type and target type for method call:Sets.newLinkedHashSet() +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Platform.java:[126,91] [[immutability, pico, piconoinit, allcheckers]:static.receiverdependentmutable.forbidden] [@ReceiverDependentMutable] is forbidden in static context +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/hash/Striped64.java:[303,26] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/hash/Striped64.java:[28,33] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.extends.clause] Class with annotation @Mutable cannot extend @Immutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/hash/Striped64.java:[153,14] [[immutability, pico, piconoinit, allcheckers]:super.invocation.invalid] Constructor of type @Mutable cannot call super() of type @Immutable. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/primitives/UnsignedBytes.java:[359,30] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/primitives/UnsignedInteger.java:[51,43] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.extends.clause] Class with annotation @Mutable cannot extend @Immutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/primitives/UnsignedInteger.java:[58,37] [[immutability, pico, piconoinit, allcheckers]:super.invocation.invalid] Constructor of type @Mutable cannot call super() of type @Immutable. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AtomicDouble.java:[62,34] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.extends.clause] Class with annotation @Mutable cannot extend @Immutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AtomicDouble.java:[76,43] [[immutability, pico, piconoinit, allcheckers]:super.invocation.invalid] Constructor of type @Mutable cannot call super() of type @Immutable. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/util/concurrent/AtomicDouble.java:[81,24] [[immutability, pico, piconoinit, allcheckers]:super.invocation.invalid] Constructor of type @Mutable cannot call super() of type @Immutable. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[257,27] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ValueEntry + method return type: @PolyMutable ValueEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[257,27] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @Immutable ValueEntry <: @PolyMutable ValueEntry + use of T from requireNonNull(predecessorInMultimap) <: @PolyMutable ValueEntry + From complementary bound.: use of T from requireNonNull(predecessorInMultimap) -> @PolyMutable ValueEntry + From: Constraint between method call type and target type for method call:requireNonNull(predecessorInMultimap) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[261,27] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ValueEntry + method return type: @PolyMutable ValueEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[261,27] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @Immutable ValueEntry <: @PolyMutable ValueEntry + use of T from requireNonNull(successorInMultimap) <: @PolyMutable ValueEntry + From complementary bound.: use of T from requireNonNull(successorInMultimap) -> @PolyMutable ValueEntry + From: Constraint between method call type and target type for method call:requireNonNull(successorInMultimap) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[281,95] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of LinkedHashMultimapGwtSerializationDependencies constructor. + found : @Mutable Map> + required: @ReceiverDependentMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[342,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable Set<@PolyMutable Entry> + method return type: @PolyMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[458,50] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable ValueSetLink + required: @Mutable ValueSetLink +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[491,64] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to mask() not allowed on the given receiver. + found : @Mutable LinkedHashMultimap.@Readonly ValueSet + required: @Mutable LinkedHashMultimap.@PICOLost ValueSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[513,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter succ of LinkedHashMultimap.succeedsInValueSet. + found : @Immutable ValueEntry + required: @Mutable ValueSetLink +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[514,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter pred of LinkedHashMultimap.succeedsInValueSet. + found : @Immutable ValueEntry + required: @Mutable ValueSetLink +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[535,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ValueEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[555,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable ValueEntry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[557,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entry of LinkedHashMultimap.deleteFromValueSet. + found : @Immutable ValueEntry + required: @Mutable ValueSetLink +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[601,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ValueEntry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[615,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator<@Mutable Entry> + method return type: @Mutable Spliterator<@PolyMutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[615,35] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Spliterators.spliterator + unsatisfiable constraint: @Mutable Entry <: @PolyMutable Entry + use of T from Spliterators.spliterator(entries(), Spliterator.DISTINCT | Spliterator.ORDERED) <: @PolyMutable Entry + From complementary bound.: use of T from Spliterators.spliterator(entries(), Spliterator.DISTINCT | Spliterator.ORDERED) <= @PolyMutable Entry + inference type: java.util.Spliterator <: @Mutable Spliterator<@PolyMutable Entry> + inference type: java.util.Spliterator -> @Mutable Spliterator<@PolyMutable Entry> + From: Constraint between method call type and target type for method call:Spliterators.spliterator(entries(), Spliterator.DISTINCT | Spliterator.ORDERED) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[655,24] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable LinkedHashMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[657,21] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable LinkedHashMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[662,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[663,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg1 of Map.put. + found : @ReceiverDependentMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[668,14] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Mutable Object" to "K [ extends @Immutable Object super @PICOBottom NullType ]" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultimap.java:[677,10] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to setMap(java.util.Map>) not allowed on the given receiver. + found : @ReceiverDependentMutable LinkedHashMultimap + required: @Mutable AbstractMapBasedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultiset.java:[87,10] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backingMap of AbstractMapBasedMultiset constructor. + found : @Mutable LinkedHashMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultiset.java:[91,57] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backingMap of AbstractMapBasedMultiset constructor. + found : @Mutable LinkedHashMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultiset.java:[101,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of Serialization.writeMultiset. + found : @ReceiverDependentMutable LinkedHashMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultiset.java:[108,18] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backingMap of AbstractMapBasedMultiset.setBackingMap. + found : @Mutable LinkedHashMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultiset.java:[109,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of Serialization.populateMultiset. + found : @ReceiverDependentMutable LinkedHashMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/LinkedHashMultiset.java:[123,84] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to remove(@org.checkerframework.checker.pico.qual.Readonly java.lang.Object,int) not allowed on the given receiver. + found : @ReceiverDependentMutable LinkedHashMultiset + required: @Mutable AbstractMapBasedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[81,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[91,40] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[113,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[123,39] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[145,34] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[155,40] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[177,33] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[187,41] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[209,32] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[219,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[219,29] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Iterables.getFirst + unsatisfiable constraint: @Readonly Entry <: @Mutable Entry + use of T from Iterables.getFirst(entrySet(), null) <: @Mutable Entry + From complementary bound.: use of T from Iterables.getFirst(entrySet(), null) -> @Mutable Entry + From: Constraint between method call type and target type for method call:Iterables.getFirst(entrySet(), null) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[239,31] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[249,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[249,29] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Iterables.getFirst + unsatisfiable constraint: @Readonly Entry <: @Mutable Entry + use of T from Iterables.getFirst(descendingMap().entrySet(), null) <: @Mutable Entry + From complementary bound.: use of T from Iterables.getFirst(descendingMap().entrySet(), null) -> @Mutable Entry + From: Constraint between method call type and target type for method call:Iterables.getFirst(descendingMap().entrySet(), null) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[321,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable ForwardingNavigableMap + method return type: @PolyMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ForwardingNavigableMap.java:[383,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of NavigableKeySet constructor. + found : @Mutable ForwardingNavigableMap + required: @ReceiverDependentMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/TransformedListIterator.java:[43,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable ListIterator + method return type: @Mutable ListIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/FinalizableSoftReference.java:[43,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter q of SoftReference constructor. + found : @Mutable ReferenceQueue<@Mutable Object> + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[66,18] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : V extends @Readonly Object @Mutable [] @Mutable [] + required: V extends @Readonly Object @Immutable [] @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[69,16] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[70,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[88,26] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[89,29] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[136,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable UnmodifiableIterator<@Mutable Entry> + method return type: @Immutable UnmodifiableIterator<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[146,40] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[257,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of ImmutableMap.copyOf. + found : @Immutable ImmutableMap> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[264,45] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of ImmutableMap.copyOf. + found : @Immutable ImmutableMap> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[299,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter cellRowIndices of SerializedForm.create. + found : @Immutable int @Immutable [] + required: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/DenseImmutableTable.java:[299,55] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter cellColumnIndices of SerializedForm.create. + found : @Immutable int @Immutable [] + required: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java:[58,50] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java:[67,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Map + required: @Immutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java:[82,41] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Immutable JdkBackedImmutableMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java:[82,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of ElementSet constructor. + found : @Immutable ImmutableList<@Mutable Entry> + required: @Mutable List<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java:[82,69] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of ElementSet constructor. + found : @Immutable JdkBackedImmutableMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[136,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Immutable EmptyModifiableIterator" to "@Mutable Iterator" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[148,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Readonly () not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[148,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[181,19] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Readonly Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[286,32] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Readonly Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[287,32] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Readonly Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[308,29] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Readonly Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[322,27] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Readonly Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[329,42] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Readonly Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[479,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Readonly () not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[479,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Iterator> + method return type: @Mutable Iterator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[639,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Readonly () not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[639,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator<@Mutable List<@org.checkerframework.checker.nullness.qual.Nullable T extends @Readonly Object>> + method return type: @Immutable UnmodifiableIterator<@Mutable List<@org.checkerframework.checker.nullness.qual.Nullable T extends @Readonly Object>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[664,17] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List + method return type: @Mutable List<@org.checkerframework.checker.nullness.qual.Nullable T extends @Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[666,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable List + method return type: @Mutable List<@org.checkerframework.checker.nullness.qual.Nullable T extends @Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[680,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable UnmodifiableIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1012,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Readonly () not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1012,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Iterator + method return type: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1092,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable ArrayItr + method return type: @Immutable UnmodifiableListIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1098,84] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of ArrayItr constructor. + found : @Mutable Object @Mutable [] + required: @Mutable Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1123,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Readonly () not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1123,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1156,11] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Readonly () not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1156,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly UnmodifiableIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1232,22] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly PeekingImpl +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1232,37] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @PICOLost Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1233,18] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly PeekingImpl +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1318,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable MergingIterator + method return type: @Immutable UnmodifiableIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1332,105] [[immutability, pico, piconoinit, allcheckers]:declaration.inconsistent.with.extends.clause] Class with annotation @ReceiverDependentMutable cannot extend @Immutable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1336,99] [[immutability, pico, piconoinit, allcheckers]:super.invocation.invalid] Constructor of type @ReceiverDependentMutable cannot call super() of type @Immutable. +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1399,26] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable ConcatenatedIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1399,53] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator> + required: @PolyMutable Iterator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1399,53] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to removeFirst() not allowed on the given receiver. + found : @PolyMutable Deque<@Mutable Iterator>> + required: @Mutable Deque<@Mutable Iterator>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1413,24] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly ConcatenatedIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1413,44] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly Iterator> + required: @PICOLost Iterator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1418,17] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly ConcatenatedIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1418,39] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @PICOLost Iterator> + required: @Mutable Iterator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1425,19] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly ConcatenatedIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1431,12] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly ConcatenatedIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1431,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable ArrayDeque<@Mutable Iterator>> + required: @PICOLost Deque<@Mutable Iterator>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1433,37] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to addFirst(E) not allowed on the given receiver. + found : @PICOLost Deque<@Mutable Iterator>> + required: @Mutable Deque<@Mutable Iterator>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1433,42] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of Deque.addFirst. + found : @PICOLost Iterator> + required: @Mutable Iterator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1436,41] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to addFirst(E) not allowed on the given receiver. + found : @PICOLost Deque<@Mutable Iterator>> + required: @Mutable Deque<@Mutable Iterator>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1439,10] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @Readonly ConcatenatedIterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1439,42] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Iterator> + required: @PICOLost Iterator> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1449,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Iterators.java:[1450,28] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to next() not allowed on the given receiver. + found : @Readonly Iterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredMultimapValues.java:[88,85] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter target of Predicates.in. + found : @Readonly Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/FilteredMultimapValues.java:[98,73] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter target of Predicates.in. + found : @Readonly Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/cache/Striped64.java:[297,26] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[55,32] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to comparator() not allowed on the given receiver. + found : @Readonly SortedMultiset + required: @PICOLost SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[60,40] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly NavigableSet + method return type: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[60,62] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to elementSet() not allowed on the given receiver. + found : @Readonly SortedMultiset + required: @PICOLost SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[65,11] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Immutable Set" to "@Mutable NavigableSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[75,56] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to delegate() not allowed on the given receiver. + found : @Readonly UnmodifiableSortedMultiset + required: @Immutable UnmodifiableSortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[75,77] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to descendingMultiset() not allowed on the given receiver. + found : @Readonly SortedMultiset + required: @PICOLost SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[76,34] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly UnmodifiableSortedMultiset + required: @Immutable UnmodifiableSortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[85,32] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to firstEntry() not allowed on the given receiver. + found : @Readonly SortedMultiset + required: @PICOLost SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[91,31] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to lastEntry() not allowed on the given receiver. + found : @Readonly SortedMultiset + required: @PICOLost SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[108,47] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly SortedMultiset + method return type: @Mutable SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[108,71] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to headMultiset(E,com.google.common.collect.BoundType) not allowed on the given receiver. + found : @Readonly SortedMultiset + required: @PICOLost SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[117,47] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly SortedMultiset + method return type: @Mutable SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[118,30] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to subMultiset(E,com.google.common.collect.BoundType,E,com.google.common.collect.BoundType) not allowed on the given receiver. + found : @Readonly SortedMultiset + required: @PICOLost SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[123,47] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly SortedMultiset + method return type: @Mutable SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java:[123,71] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to tailMultiset(E,com.google.common.collect.BoundType) not allowed on the given receiver. + found : @Readonly SortedMultiset + required: @PICOLost SortedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/EndpointPairIterator.java:[43,63] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable UnmodifiableIterator + required: @Mutable Iterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/EndpointPairIterator.java:[124,57] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Sets.newHashSetWithExpectedSize + unsatisfiable constraint: N extends @Readonly Object <: @Immutable Object + use of E from Sets.newHashSetWithExpectedSize(graph.nodes().size() + 1) = N extends @Readonly Object + From complementary bound.: use of E from Sets.newHashSetWithExpectedSize(graph.nodes().size() + 1) <= N extends @Readonly Object + inference type: java.util.HashSet <: @Mutable Set + inference type: java.util.HashSet -> @Mutable Set + From: Constraint between method call type and target type for method call:Sets.newHashSetWithExpectedSize(graph.nodes().size() + 1) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/StandardNetwork.java:[59,25] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of MapIteratorCache. + found : N extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/StandardNetwork.java:[63,25] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of MapIteratorCache. + found : E extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/StandardNetwork.java:[80,10] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Map. + found : N extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/StandardNetwork.java:[81,10] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of Map. + found : E extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/StandardNetwork.java:[92,35] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K of MapIteratorCache. + found : N extends @Readonly Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/StandardNetwork.java:[93,31] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for MapIteratorCache constructor + unsatisfiable constraint: E extends @Readonly Object <: @Immutable Object + E extends @Readonly Object = use of K from new MapIteratorCache<>(edgeToReferenceNode) + From complementary bound.: E extends @Readonly Object <= use of K from new MapIteratorCache<>(edgeToReferenceNode) + @Mutable Map <: inference type: @org.checkerframework.checker.pico.qual.ReceiverDependentMutable java.util.Map + @Mutable Map -> inference type: @org.checkerframework.checker.pico.qual.ReceiverDependentMutable java.util.Map + edgeToReferenceNode -> inference type: @org.checkerframework.checker.pico.qual.ReceiverDependentMutable java.util.Map + From: Argument constraint +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/StandardNetwork.java:[98,45] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/StandardNetwork.java:[103,49] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/graph/StandardNetwork.java:[153,28] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSet + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[141,40] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter K0 of MultimapBuilderWithKeys. + found : @Mutable Comparable + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[142,19] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for MultimapBuilder.treeKeys + unsatisfiable constraint: @Mutable Comparable <: @Immutable Object + use of K0 from treeKeys(Ordering.natural()) = @Mutable Comparable + From complementary bound.: use of K0 from treeKeys(Ordering.natural()) <= @Mutable Comparable + inference type: com.google.common.collect.MultimapBuilder.MultimapBuilderWithKeys <: @Mutable MultimapBuilderWithKeys<@Mutable Comparable> + inference type: com.google.common.collect.MultimapBuilder.MultimapBuilderWithKeys -> @Mutable MultimapBuilderWithKeys<@Mutable Comparable> + From: Constraint between method call type and target type for method call:treeKeys(Ordering.natural()) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[207,33] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Immutable LinkedListSupplier" to "@Mutable Supplier" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[255,13] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for TreeSet constructor + unsatisfiable constraint: V extends @Readonly Object <: @Immutable Object + use of E from new TreeSet<>(comparator) = V extends @Readonly Object + From complementary bound.: use of E from new TreeSet<>(comparator) <= V extends @Readonly Object + inference type: java.util.TreeSet <: @Mutable SortedSet + inference type: java.util.TreeSet -> @Mutable SortedSet + From: Constraint between method call type and target type for method call:new TreeSet<>(comparator) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[387,85] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter comparator of TreeSetSupplier constructor. + found : @Mutable Comparator + required: @Mutable Comparator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[393,56] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V0 of SetMultimapBuilder. + found : V0 extends @Immutable Enum + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[395,40] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter V0 of SetMultimapBuilder. + found : V0 extends @Immutable Enum> + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[397,40] [[immutability, pico, piconoinit, allcheckers]:type.invalid.annotations.on.use] invalid type: annotations [@Readonly] conflict with declaration of type java.lang.Enum +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[397,69] [[immutability, pico, piconoinit, allcheckers]:type.invalid.annotations.on.use] invalid type: annotations [@Readonly] conflict with declaration of type java.lang.Enum +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[401,23] [[immutability, pico, piconoinit, allcheckers]:type.invalid.annotations.on.use] invalid type: annotations [@Readonly] conflict with declaration of type java.lang.Enum +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[402,86] [[immutability, pico, piconoinit, allcheckers]:type.invalid.annotations.on.use] invalid type: annotations [@Readonly] conflict with declaration of type java.lang.Enum +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MultimapBuilder.java:[402,90] [[immutability, pico, piconoinit, allcheckers]:type.invalid.annotations.on.use] invalid type: annotations [@Readonly] conflict with declaration of type java.lang.Enum +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/SingletonImmutableBiMap.java:[97,46] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter element of ImmutableSet.of. + found : @Immutable Entry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSet.java:[55,20] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Readonly [] + required: @Mutable Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSet.java:[57,17] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Object @Mutable [] + required: @Mutable Object @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSet.java:[86,56] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter array of Iterators.forArray. + found : @Mutable Object @Immutable [] + required: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSet.java:[91,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Spliterator + method return type: @Mutable Spliterator +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableSet.java:[96,11] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Object @Immutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[144,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[145,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[151,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[151,23] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[152,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[152,21] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[160,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[161,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[190,17] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[196,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[226,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[226,31] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[227,14] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[227,29] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable int @Mutable [] + required: @Immutable int @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[242,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter c of ObjectArrays.toArrayImpl. + found : @ReceiverDependentMutable CompactLinkedHashSet + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[261,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[262,4] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable CompactLinkedHashSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[265,18] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of Arrays.fill. + found : @Immutable int @ReceiverDependentMutable [] + required: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[266,18] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter a of Arrays.fill. + found : @Immutable int @ReceiverDependentMutable [] + required: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[277,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable int @ReceiverDependentMutable [] + method return type: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[277,25] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @Immutable int @ReceiverDependentMutable [] <: @Immutable int @Mutable [] + use of T from requireNonNull(predecessor) <: @Immutable int @Mutable [] + From complementary bound.: use of T from requireNonNull(predecessor) -> @Immutable int @Mutable [] + From: Constraint between method call type and target type for method call:requireNonNull(predecessor) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[281,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable int @ReceiverDependentMutable [] + method return type: @Immutable int @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CompactLinkedHashSet.java:[281,25] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Objects.requireNonNull + unsatisfiable constraint: @Immutable int @ReceiverDependentMutable [] <: @Immutable int @Mutable [] + use of T from requireNonNull(successor) <: @Immutable int @Mutable [] + From complementary bound.: use of T from requireNonNull(successor) -> @Immutable int @Mutable [] + From: Constraint between method call type and target type for method call:requireNonNull(successor) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableMap.java:[94,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegateMap of JdkBackedImmutableMap constructor. + found : @Mutable Map + required: @Immutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/JdkBackedImmutableMap.java:[118,60] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularEntrySet constructor. + found : @Immutable ImmutableList<@Mutable Entry> + required: @Immutable ImmutableList<@Immutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[59,22] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularImmutableBiMap constructor. + found : @Mutable Entry<@Immutable Object, @Immutable Object> @Mutable [] + required: @Immutable Entry<@Immutable Object, @Immutable Object> @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[70,42] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryArray of RegularImmutableBiMap.fromEntryArray. + found : @Immutable Entry @Mutable [] + required: @Immutable Entry @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[86,33] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Readonly Entry @Mutable [] + required: @Mutable Entry @Readonly [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[86,35] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Immutable Entry @Immutable []" to "@Mutable Entry @Mutable []" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[106,49] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entryArray of JdkBackedImmutableBiMap.create. + found : @Immutable Entry @Immutable [] + required: @Mutable Entry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[115,19] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Immutable ImmutableMapEntry + required: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[118,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter keyTable of RegularImmutableBiMap constructor. + found : @Immutable ImmutableMapEntry @Mutable [] + required: @Immutable ImmutableMapEntry @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[118,49] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter valueTable of RegularImmutableBiMap constructor. + found : @Immutable ImmutableMapEntry @Mutable [] + required: @Immutable ImmutableMapEntry @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[118,61] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularImmutableBiMap constructor. + found : @Mutable Entry @Mutable [] + required: @Immutable Entry @Immutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[156,40] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter keyTable of RegularImmutableMap.get. + found : @Immutable ImmutableMapEntry @Immutable [] + required: @Immutable ImmutableMapEntry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[162,8] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable ImmutableSet<@Readonly Entry> + method return type: @Immutable ImmutableSet<@Immutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[163,63] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter entries of RegularEntrySet constructor. + found : @Immutable Entry @Immutable [] + required: @Immutable Entry @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[253,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable RegularImmutableBiMap.@Immutable Inverse.@Immutable InverseEntrySet + method return type: @Immutable ImmutableSet<@Immutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[285,15] [[immutability, pico, piconoinit, allcheckers]:constructor.invocation.invalid] creation of @Immutable RegularImmutableBiMap.@Immutable Inverse.@Immutable InverseEntrySet.@Readonly (@Immutable RegularImmutableBiMap.@Immutable Inverse.@Immutable InverseEntrySet this) not allowed with given receiver. + found : @Readonly + required: @Readonly +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[285,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly ImmutableList<@Mutable Entry> + method return type: @Immutable ImmutableList<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/RegularImmutableBiMap.java:[289,38] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/base/FinalizablePhantomReference.java:[45,25] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter q of PhantomReference constructor. + found : @Mutable ReferenceQueue<@Mutable Object> + required: @Mutable ReferenceQueue +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[270,33] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Object @Mutable [] + method return type: @Mutable Object @Mutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[355,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedSet + method return type: @PolyMutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[355,42] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Synchronized.sortedSet. + found : @PolyMutable SortedSet + required: @Mutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[363,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedSet + method return type: @PolyMutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[363,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Synchronized.sortedSet. + found : @PolyMutable SortedSet + required: @Mutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[371,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedSet + method return type: @PolyMutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[371,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Synchronized.sortedSet. + found : @PolyMutable SortedSet + required: @Mutable SortedSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[410,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Collection" to "@Mutable List" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[410,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable List + method return type: @PolyMutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[492,19] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable List + method return type: @PolyMutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[492,38] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter list of Synchronized.list. + found : @PolyMutable List + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[548,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Collection" to "@Mutable Multiset" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[548,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Multiset + method return type: @PolyMutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[591,21] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[591,40] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set + required: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[591,62] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Synchronized.typePreservingSet. + found : @PolyMutable Set + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[602,19] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[602,38] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set<@Mutable Entry> + required: @PolyMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[602,58] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Synchronized.typePreservingSet. + found : @PolyMutable Set<@Mutable Entry> + required: @Mutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[650,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Object" to "@Mutable Multimap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[650,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Multimap + method return type: @PolyMutable Multimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[700,54] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter collection of Synchronized.typePreservingCollection. + found : @Readonly Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[758,17] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[758,36] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set + required: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[758,54] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Synchronized.typePreservingSet. + found : @PolyMutable Set + required: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[769,27] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[769,39] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Collection + required: @PolyMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[769,57] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter collection of Synchronized.collection. + found : @PolyMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[780,18] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[780,44] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Collection<@Mutable Entry> + required: @PolyMutable Collection<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[780,63] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter collection of Synchronized.typePreservingCollection. + found : @PolyMutable Collection<@PolyMutable Entry> + required: @Mutable Collection<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[797,16] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[797,18] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable SynchronizedAsMap + required: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[797,58] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of SynchronizedAsMap constructor. + found : @PolyMutable Map> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[807,15] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[807,25] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Multiset + required: @PolyMutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[807,41] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of Synchronized.multiset. + found : @PolyMutable Multiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[853,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Multimap" to "@Mutable ListMultimap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[853,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable ListMultimap + method return type: @PolyMutable ListMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[859,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter list of Synchronized.list. + found : @PICOLost List + required: @Mutable List +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[900,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Multimap" to "@Mutable SetMultimap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[900,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SetMultimap + method return type: @PolyMutable SetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[906,18] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[913,35] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[920,39] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Readonly Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[929,19] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[929,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Synchronized.set. + found : @PolyMutable Set<@PolyMutable Entry> + required: @PolyMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[957,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable SetMultimap" to "@Mutable SortedSetMultimap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[957,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedSetMultimap + method return type: @PolyMutable SortedSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[985,41] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to valueComparator() not allowed on the given receiver. + found : @Readonly SortedSetMultimap + required: @PICOLost SortedSetMultimap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1057,70] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter c of ObjectArrays.toArrayImpl. + found : @ReceiverDependentMutable Set<@Mutable Entry>> + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1141,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Object" to "@Mutable Map" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1141,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map + method return type: @PolyMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1172,19] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1172,44] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter set of Synchronized.set. + found : @PolyMutable Set<@PolyMutable Entry> + required: @PolyMutable Set<@Mutable Entry> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1198,38] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to getOrDefault(java.lang.Object,V) not allowed on the given receiver. + found : @Readonly Map + required: @PICOLost Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1214,17] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1324,17] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1324,29] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Collection + required: @PolyMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1324,47] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter collection of Synchronized.collection. + found : @PolyMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1367,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Map" to "@Mutable SortedMap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1367,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedMap + method return type: @PolyMutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1388,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter sortedMap of Synchronized.sortedMap. + found : @Readonly SortedMap + required: @Mutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1402,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedMap + method return type: @PolyMutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1402,42] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter sortedMap of Synchronized.sortedMap. + found : @PolyMutable SortedMap + required: @Mutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1409,24] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable SortedMap + method return type: @PolyMutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1409,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter sortedMap of Synchronized.sortedMap. + found : @PolyMutable SortedMap + required: @Mutable SortedMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1439,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Map" to "@Mutable BiMap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1439,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable BiMap + method return type: @PolyMutable BiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1447,19] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1447,24] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable Set + required: @PolyMutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1465,18] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedBiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1465,20] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable SynchronizedBiMap + required: @PolyMutable BiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1465,62] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of SynchronizedBiMap constructor. + found : @PolyMutable BiMap + required: @Mutable BiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1465,73] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter inverse of SynchronizedBiMap constructor. + found : @PolyMutable SynchronizedBiMap + required: @Mutable BiMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1498,24] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedAsMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1498,26] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable SynchronizedAsMapEntries + required: @PolyMutable Set<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1498,76] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of SynchronizedAsMapEntries constructor. + found : @PolyMutable Set<@PolyMutable Entry>> + required: @Mutable Set<@Mutable Entry>> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1509,22] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedAsMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1509,24] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable SynchronizedAsMapValues + required: @PolyMutable Collection<@Mutable Collection> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1509,72] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of SynchronizedAsMapValues constructor. + found : @PolyMutable Collection<@Mutable Collection> + required: @Mutable Collection<@Mutable Collection> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1586,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable SortedSet" to "@Mutable NavigableSet" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1586,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableSet + method return type: @PolyMutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1608,81] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter navigableSet of Synchronized.navigableSet. + found : @PolyMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1609,24] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @PolyMutable SynchronizedNavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1609,26] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableSet + required: @PolyMutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1610,17] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable NavigableSet + method return type: @PolyMutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1627,59] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter navigableSet of Synchronized.navigableSet. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1656,35] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to pollFirst() not allowed on the given receiver. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1664,34] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to pollLast() not allowed on the given receiver. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1673,29] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter navigableSet of Synchronized.navigableSet. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1685,59] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter navigableSet of Synchronized.navigableSet. + found : @ReceiverDependentMutable NavigableSet + required: @Mutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1732,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable SortedMap" to "@Mutable NavigableMap" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1757,34] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable SynchronizedNavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1757,34] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1757,61] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableSet + required: @ReceiverDependentMutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1759,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1769,31] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable SynchronizedNavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1769,31] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableMap + method return type: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1769,45] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableMap + required: @ReceiverDependentMutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1771,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableMap + method return type: @Mutable NavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1862,33] [[immutability, pico, piconoinit, allcheckers]:illegal.field.write] Cannot write field via receiver: @ReceiverDependentMutable SynchronizedNavigableMap +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1862,33] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1862,60] [[immutability, pico, piconoinit, allcheckers]:assignment.type.incompatible] incompatible types in assignment. + found : @Mutable NavigableSet + required: @ReceiverDependentMutable NavigableSet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1864,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable NavigableSet + method return type: @Mutable NavigableSet<@org.checkerframework.checker.nullness.qual.KeyFor({"this"}) K extends @Immutable Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1935,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Object" to "@Mutable Entry" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[1990,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@ReceiverDependentMutable Collection" to "@Mutable Queue" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2034,33] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter E of SynchronizedDeque. + found : E extends @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2193,13] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@PolyMutable Object" to "@Mutable Table" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2193,13] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Table + method return type: @PolyMutable Table +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2279,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Synchronized.map. + found : @ReceiverDependentMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2286,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter map of Synchronized.map. + found : @ReceiverDependentMutable Map + required: @Mutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2314,25] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Collection + method return type: @PolyMutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2314,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter collection of Synchronized.collection. + found : @PolyMutable Collection + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2321,18] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map> + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2323,33] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformValues. + found : @PolyMutable Map> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2337,18] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Mutable Map> + method return type: @PolyMutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/Synchronized.java:[2339,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter fromMap of Maps.transformValues. + found : @PolyMutable Map> + required: @Mutable Map> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/hash/LittleEndianByteArray.java:[181,28] [removal] AccessController in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java:[51,73] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter delegate of ImmutableClassToInstanceMap constructor. + found : @Immutable ImmutableMap<@Immutable Class, @Mutable Object> + required: @Immutable ImmutableMap<@Immutable Class, @Readonly Object> +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MoreCollectors.java:[50,18] [[immutability, pico, piconoinit, allcheckers]:type.arguments.not.inferred] Could not infer type arguments for Collector.of + unsatisfiable constraint: @Readonly Object <: @Mutable Object + use of T from Collector.of(ToOptionalState::new, ToOptionalState::add, ToOptionalState::combine, ToOptionalState::getOptional, Collector.Characteristics.UNORDERED) = @Readonly Object + From complementary bound.: use of T from Collector.of(ToOptionalState::new, ToOptionalState::add, ToOptionalState::combine, ToOptionalState::getOptional, Collector.Characteristics.UNORDERED) <= @Readonly Object + inference type: java.util.stream.Collector <: @Mutable Collector<@Readonly Object, ? extends @Readonly Object, @Immutable Optional<@Readonly Object>> + inference type: java.util.stream.Collector -> @Mutable Collector<@Readonly Object, ? extends @Readonly Object, @Immutable Optional<@Readonly Object>> + From: Constraint between method call type and target type for method call:Collector.of(ToOptionalState::new, ToOptionalState::add, ToOptionalState::combine, ToOptionalState::getOptional, Collector.Characteristics.UNORDERED) +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/MoreCollectors.java:[75,46] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter o of ToOptionalState.add. + found : @Readonly Object + required: @Mutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultiset.java:[72,70] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter elements of Multisets.inferDistinctElements. + found : @Readonly Iterable + required: @Mutable Iterable +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultiset.java:[78,10] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backingMap of AbstractMapBasedMultiset constructor. + found : @Mutable HashMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultiset.java:[82,51] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backingMap of AbstractMapBasedMultiset constructor. + found : @Mutable HashMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultiset.java:[92,32] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of Serialization.writeMultiset. + found : @ReceiverDependentMutable HashMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultiset.java:[99,43] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter backingMap of AbstractMapBasedMultiset.setBackingMap. + found : @Mutable HashMap + required: @ReceiverDependentMutable Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/HashMultiset.java:[100,35] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter multiset of Serialization.populateMultiset. + found : @ReceiverDependentMutable HashMultiset + required: @Mutable Multiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/reflect/Types.java:[372,19] [removal] AccessControlException in java.security has been deprecated and marked for removal +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/NaturalOrdering.java:[46,12] [[immutability, pico, piconoinit, allcheckers]:cast.unsafe] cast from "@Readonly Comparable" to "@Mutable Comparable<@Readonly Object>" cannot be statically verified +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[171,46] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to values() not allowed on the given receiver. + found : @PICOLost ConcurrentMap + required: @PICOLost Map +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[183,137] [[immutability, pico, piconoinit, allcheckers]:type.argument.type.incompatible] incompatible type argument for type parameter E of ConcurrentHashMultiset. + found : E extends @PolyMutable Object + required: @Immutable Object +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[184,29] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @PolyMutable Object @Mutable [] + method return type: @PolyMutable Object @ReceiverDependentMutable [] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[434,36] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of ConcurrentMap.putIfAbsent. + found : E [ extends @Immutable Object super @Immutable NullType ] + required: E [ extends @Immutable Object super @PICOBottom NullType ] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[446,39] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of ConcurrentMap.putIfAbsent. + found : E [ extends @Immutable Object super @Immutable NullType ] + required: E [ extends @Immutable Object super @PICOBottom NullType ] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[447,34] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter arg0 of ConcurrentMap.replace. + found : E [ extends @Immutable Object super @Immutable NullType ] + required: E [ extends @Immutable Object super @PICOBottom NullType ] +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[471,15] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @ReceiverDependentMutable Set + method return type: @Mutable Set +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[486,57] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter collection of Collections2.safeRemove. + found : @ReceiverDependentMutable Set + required: @Mutable Collection +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[539,47] [[immutability, pico, piconoinit, allcheckers]:return.type.incompatible] incompatible types in return. + type of expression: @Immutable Entry + method return type: @Mutable Entry +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[612,75] [[immutability, pico, piconoinit, allcheckers]:method.invocation.invalid] call to size() not allowed on the given receiver. + found : @Mutable ConcurrentHashMultiset.@Readonly EntrySet + required: @Mutable AbstractMultiset.@PICOLost EntrySet +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/ConcurrentHashMultiset.java:[638,50] [[immutability, pico, piconoinit, allcheckers]:argument.type.incompatible] incompatible argument for parameter instance of FieldSetter.set. + found : @ReceiverDependentMutable ConcurrentHashMultiset + required: @Mutable ConcurrentHashMultiset +[WARNING] /Users/aosenxiong/waterloo/eisop/guava/guava/src/com/google/common/collect/CollectSpliterators.java:[61,38] [[immutability, pico, piconoinit, allcheckers]:static.receiverdependentmutable.forbidden] [@ReceiverDependentMutable] is forbidden in static context +[INFO] 2285 warnings +[INFO] ------------------------------------------------------------- +[INFO] ------------------------------------------------------------- +[ERROR] COMPILATION ERROR : +[INFO] ------------------------------------------------------------- +[ERROR] error: Wildcard /*INFERENCE FAILED for:*/ ? extends @Mutable Object is not a type argument of @Mutable ListenableFuture +[ERROR] error: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture +[ERROR] error: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture +[ERROR] error: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture +[INFO] 4 errors +[INFO] ------------------------------------------------------------- +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD FAILURE +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 01:05 min +[INFO] Finished at: 2025-10-30T16:08:34-04:00 +[INFO] ------------------------------------------------------------------------ +[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (main-compile) on project guava: Compilation failure: Compilation failure: +[ERROR] error: Wildcard /*INFERENCE FAILED for:*/ ? extends @Mutable Object is not a type argument of @Mutable ListenableFuture +[ERROR] error: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture +[ERROR] error: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture +[ERROR] error: Wildcard /*INFERENCE FAILED for:*/ ? extends @Readonly Object is not a type argument of @Mutable ListenableFuture +[ERROR] -> [Help 1] +[ERROR] +[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. +[ERROR] Re-run Maven using the -X switch to enable full debug logging. +[ERROR] +[ERROR] For more information about the errors and possible solutions, please read the following articles: +[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException diff --git a/typecheck.sh b/typecheck.sh index 8b51b72f386b..8e7b08f65f36 100755 --- a/typecheck.sh +++ b/typecheck.sh @@ -18,7 +18,7 @@ fi # This also builds annotation-tools. # Run assembleForJavac because it does not build the javadoc, so it is faster than assemble. -(cd "${CHECKERFRAMEWORK}" && ./gradlew assembleForJavac --console=plain -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.http.connectionTimeout=60000 ) +#(cd "${CHECKERFRAMEWORK}" && ./gradlew assembleForJavac --console=plain -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.http.connectionTimeout=60000 ) # As of 7/27/2019, there are only annotations for: # * index @@ -42,6 +42,10 @@ elif [[ "$1" == "signature" ]]; then (cd guava && mvn -B compile -P checkerframework-local -Dcheckerframework.checkers=org.checkerframework.checker.signature.SignatureChecker) elif [[ "$1" == "signedness" ]]; then (cd guava && mvn -B compile -P checkerframework-local -Dcheckerframework.checkers=org.checkerframework.checker.signedness.SignednessChecker) +elif [[ "$1" == "pico" ]]; then +# (cd guava && mvn -B compile -P checkerframework-local -Dcheckerframework.checkers=org.checkerframework.checker.pico.PICOChecker -Dcheckerframework.extraargs="-AonlyDefs=^com\.google\.common\.collect" -Dcheckerframework.extraargs="-AonlyAnnotatedFor") + (cd guava && mvn -B clean compile -P checkerframework-local -Dcheckerframework.checkers=org.checkerframework.checker.pico.PICOChecker -Dcheckerframework.extraargs="-AassumeInitialized") +# (cd guava && mvn -B compile -P checkerframework-local -Dcheckerframework.checkers=org.checkerframework.checker.pico.PICOChecker -Dcheckerframework.extraargs="-AonlyDefs=^com\.google\.common\.collect" -Dcheckerframework.extraargs="-AassumeInitialized") elif [[ "$1" == "nothing" ]]; then true else