Skip to content

Commit 07ce1e9

Browse files
cpovirkGoogle Java Core Libraries
authored andcommitted
Hide APIs related to weighers and cache specs from J2KT.
Weighers are probably currently silently ignored. Cache specs might be OK, but they are untested, and they're not completely trivial to keep functional when we remove weighers. And neither feature is currently tested under J2KT. We could expose them again (even untested if necessary), but for now, it feels safest to withdraw these. They don't have J2KT usage (nor J2CL usage, since they're already not exposed to that platform). RELNOTES=n/a PiperOrigin-RevId: 908209811
1 parent cf9c2dd commit 07ce1e9

4 files changed

Lines changed: 30 additions & 16 deletions

File tree

android/guava/src/com/google/common/cache/CacheBuilder.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ public static CacheBuilder<Object, Object> newBuilder() {
328328
*
329329
* @since 12.0
330330
*/
331-
@GwtIncompatible // To be supported
331+
@GwtIncompatible
332+
@J2ktIncompatible
332333
public static CacheBuilder<Object, Object> from(CacheBuilderSpec spec) {
333334
return spec.toCacheBuilder().lenientParsing();
334335
}
@@ -340,7 +341,8 @@ public static CacheBuilder<Object, Object> from(CacheBuilderSpec spec) {
340341
* @param spec a String in the format specified by {@link CacheBuilderSpec}
341342
* @since 12.0
342343
*/
343-
@GwtIncompatible // To be supported
344+
@GwtIncompatible
345+
@J2ktIncompatible
344346
public static CacheBuilder<Object, Object> from(String spec) {
345347
return from(CacheBuilderSpec.parse(spec));
346348
}
@@ -350,7 +352,8 @@ public static CacheBuilder<Object, Object> from(String spec) {
350352
*
351353
* @return this {@code CacheBuilder} instance (for chaining)
352354
*/
353-
@GwtIncompatible // To be supported
355+
@GwtIncompatible
356+
@J2ktIncompatible
354357
@CanIgnoreReturnValue
355358
CacheBuilder<K, V> lenientParsing() {
356359
strictParsing = false;
@@ -365,7 +368,7 @@ CacheBuilder<K, V> lenientParsing() {
365368
*
366369
* @return this {@code CacheBuilder} instance (for chaining)
367370
*/
368-
@GwtIncompatible // To be supported
371+
@GwtIncompatible
369372
@CanIgnoreReturnValue
370373
CacheBuilder<K, V> keyEquivalence(Equivalence<Object> equivalence) {
371374
checkState(keyEquivalence == null, "key equivalence was already set to %s", keyEquivalence);
@@ -386,7 +389,7 @@ Equivalence<Object> getKeyEquivalence() {
386389
*
387390
* @return this {@code CacheBuilder} instance (for chaining)
388391
*/
389-
@GwtIncompatible // To be supported
392+
@GwtIncompatible
390393
@CanIgnoreReturnValue
391394
CacheBuilder<K, V> valueEquivalence(Equivalence<Object> equivalence) {
392395
checkState(
@@ -533,7 +536,8 @@ public CacheBuilder<K, V> maximumSize(long maximumSize) {
533536
* @throws IllegalStateException if a maximum weight or size was already set
534537
* @since 11.0
535538
*/
536-
@GwtIncompatible // To be supported
539+
@J2ktIncompatible
540+
@GwtIncompatible
537541
@CanIgnoreReturnValue
538542
public CacheBuilder<K, V> maximumWeight(long maximumWeight) {
539543
checkState(
@@ -576,7 +580,8 @@ public CacheBuilder<K, V> maximumWeight(long maximumWeight) {
576580
* previously called
577581
* @since 11.0
578582
*/
579-
@GwtIncompatible // To be supported
583+
@J2ktIncompatible
584+
@GwtIncompatible
580585
@CanIgnoreReturnValue // TODO(b/27479612): consider removing this
581586
public <K1 extends K, V1 extends V> CacheBuilder<K1, V1> weigher(
582587
Weigher<? super K1, ? super V1> weigher) {
@@ -924,7 +929,7 @@ public CacheBuilder<K, V> refreshAfterWrite(Duration duration) {
924929
* @since 11.0
925930
* @deprecated Use {@link #refreshAfterWrite(Duration)} instead.
926931
*/
927-
@GwtIncompatible // To be supported (synchronously).
932+
@GwtIncompatible
928933
@Deprecated // GoodTime
929934
@CanIgnoreReturnValue
930935
public CacheBuilder<K, V> refreshAfterWrite(long duration, TimeUnit unit) {

android/guava/src/com/google/common/cache/CacheBuilderSpec.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static java.util.concurrent.TimeUnit.SECONDS;
2525

2626
import com.google.common.annotations.GwtIncompatible;
27+
import com.google.common.annotations.J2ktIncompatible;
2728
import com.google.common.annotations.VisibleForTesting;
2829
import com.google.common.base.MoreObjects;
2930
import com.google.common.base.Splitter;
@@ -86,6 +87,7 @@
8687
*/
8788
@SuppressWarnings("GoodTime") // lots of violations (nanosecond math)
8889
@GwtIncompatible
90+
@J2ktIncompatible
8991
public final class CacheBuilderSpec {
9092
/** Parses a single value. */
9193
private interface ValueParser {

guava/src/com/google/common/cache/CacheBuilder.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ public static CacheBuilder<Object, Object> newBuilder() {
328328
*
329329
* @since 12.0
330330
*/
331-
@GwtIncompatible // To be supported
331+
@GwtIncompatible
332+
@J2ktIncompatible
332333
public static CacheBuilder<Object, Object> from(CacheBuilderSpec spec) {
333334
return spec.toCacheBuilder().lenientParsing();
334335
}
@@ -340,7 +341,8 @@ public static CacheBuilder<Object, Object> from(CacheBuilderSpec spec) {
340341
* @param spec a String in the format specified by {@link CacheBuilderSpec}
341342
* @since 12.0
342343
*/
343-
@GwtIncompatible // To be supported
344+
@GwtIncompatible
345+
@J2ktIncompatible
344346
public static CacheBuilder<Object, Object> from(String spec) {
345347
return from(CacheBuilderSpec.parse(spec));
346348
}
@@ -350,7 +352,8 @@ public static CacheBuilder<Object, Object> from(String spec) {
350352
*
351353
* @return this {@code CacheBuilder} instance (for chaining)
352354
*/
353-
@GwtIncompatible // To be supported
355+
@GwtIncompatible
356+
@J2ktIncompatible
354357
@CanIgnoreReturnValue
355358
CacheBuilder<K, V> lenientParsing() {
356359
strictParsing = false;
@@ -365,7 +368,7 @@ CacheBuilder<K, V> lenientParsing() {
365368
*
366369
* @return this {@code CacheBuilder} instance (for chaining)
367370
*/
368-
@GwtIncompatible // To be supported
371+
@GwtIncompatible
369372
@CanIgnoreReturnValue
370373
CacheBuilder<K, V> keyEquivalence(Equivalence<Object> equivalence) {
371374
checkState(keyEquivalence == null, "key equivalence was already set to %s", keyEquivalence);
@@ -386,7 +389,7 @@ Equivalence<Object> getKeyEquivalence() {
386389
*
387390
* @return this {@code CacheBuilder} instance (for chaining)
388391
*/
389-
@GwtIncompatible // To be supported
392+
@GwtIncompatible
390393
@CanIgnoreReturnValue
391394
CacheBuilder<K, V> valueEquivalence(Equivalence<Object> equivalence) {
392395
checkState(
@@ -533,7 +536,8 @@ public CacheBuilder<K, V> maximumSize(long maximumSize) {
533536
* @throws IllegalStateException if a maximum weight or size was already set
534537
* @since 11.0
535538
*/
536-
@GwtIncompatible // To be supported
539+
@J2ktIncompatible
540+
@GwtIncompatible
537541
@CanIgnoreReturnValue
538542
public CacheBuilder<K, V> maximumWeight(long maximumWeight) {
539543
checkState(
@@ -576,7 +580,8 @@ public CacheBuilder<K, V> maximumWeight(long maximumWeight) {
576580
* previously called
577581
* @since 11.0
578582
*/
579-
@GwtIncompatible // To be supported
583+
@J2ktIncompatible
584+
@GwtIncompatible
580585
@CanIgnoreReturnValue // TODO(b/27479612): consider removing this
581586
public <K1 extends K, V1 extends V> CacheBuilder<K1, V1> weigher(
582587
Weigher<? super K1, ? super V1> weigher) {
@@ -921,7 +926,7 @@ public CacheBuilder<K, V> refreshAfterWrite(Duration duration) {
921926
* @since 11.0
922927
* @deprecated Use {@link #refreshAfterWrite(Duration)} instead.
923928
*/
924-
@GwtIncompatible // To be supported (synchronously).
929+
@GwtIncompatible
925930
@Deprecated // GoodTime
926931
@CanIgnoreReturnValue
927932
public CacheBuilder<K, V> refreshAfterWrite(long duration, TimeUnit unit) {

guava/src/com/google/common/cache/CacheBuilderSpec.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static java.util.concurrent.TimeUnit.SECONDS;
2525

2626
import com.google.common.annotations.GwtIncompatible;
27+
import com.google.common.annotations.J2ktIncompatible;
2728
import com.google.common.annotations.VisibleForTesting;
2829
import com.google.common.base.MoreObjects;
2930
import com.google.common.base.Splitter;
@@ -86,6 +87,7 @@
8687
*/
8788
@SuppressWarnings("GoodTime") // lots of violations (nanosecond math)
8889
@GwtIncompatible
90+
@J2ktIncompatible
8991
public final class CacheBuilderSpec {
9092
/** Parses a single value. */
9193
private interface ValueParser {

0 commit comments

Comments
 (0)