Skip to content

Commit

Permalink
Disable GWT-RPC by default in the open-source release.
Browse files Browse the repository at this point in the history
RELNOTES=[Guava types can no longer be sent over GWT-RPC.](https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ) To _temporarily_ reenable support, set the `guava.gwt.emergency_reenable_rpc` system property to `true`.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=288676838
  • Loading branch information
cpovirk authored and netdpb committed Jan 9, 2020
1 parent 682a25f commit 5214a10
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 78 deletions.
18 changes: 1 addition & 17 deletions android/guava/src/com/google/common/base/Platform.java
Expand Up @@ -14,9 +14,6 @@

package com.google.common.base;

import static com.google.common.base.Strings.lenientFormat;
import static java.lang.Boolean.parseBoolean;

import com.google.common.annotations.GwtCompatible;
import java.lang.ref.WeakReference;
import java.util.Locale;
Expand Down Expand Up @@ -103,18 +100,5 @@ public boolean isPcreLike() {
}
}

private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";

static void checkGwtRpcEnabled() {
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
throw new UnsupportedOperationException(
lenientFormat(
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
+ " support by setting the system property %s to true. For more about system"
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
GWT_RPC_PROPERTY_NAME,
"https://stackoverflow.com/q/5189914/28465",
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
}
}
static void checkGwtRpcEnabled() {}
}
18 changes: 1 addition & 17 deletions android/guava/src/com/google/common/collect/Platform.java
Expand Up @@ -16,9 +16,6 @@

package com.google.common.collect;

import static com.google.common.base.Strings.lenientFormat;
import static java.lang.Boolean.parseBoolean;

import com.google.common.annotations.GwtCompatible;
import java.lang.reflect.Array;
import java.util.Arrays;
Expand Down Expand Up @@ -112,20 +109,7 @@ static int reduceExponentIfGwt(int exponent) {
return exponent;
}

private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";

static void checkGwtRpcEnabled() {
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
throw new UnsupportedOperationException(
lenientFormat(
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
+ " support by setting the system property %s to true. For more about system"
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
GWT_RPC_PROPERTY_NAME,
"https://stackoverflow.com/q/5189914/28465",
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
}
}
static void checkGwtRpcEnabled() {}

private Platform() {}
}
18 changes: 1 addition & 17 deletions android/guava/src/com/google/common/primitives/Platform.java
Expand Up @@ -14,28 +14,12 @@

package com.google.common.primitives;

import static com.google.common.base.Strings.lenientFormat;
import static java.lang.Boolean.parseBoolean;

import com.google.common.annotations.GwtCompatible;

/** Methods factored out so that they can be emulated differently in GWT. */
@GwtCompatible(emulated = true)
final class Platform {
private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";

static void checkGwtRpcEnabled() {
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
throw new UnsupportedOperationException(
lenientFormat(
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
+ " support by setting the system property %s to true. For more about system"
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
GWT_RPC_PROPERTY_NAME,
"https://stackoverflow.com/q/5189914/28465",
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
}
}
static void checkGwtRpcEnabled() {}

private Platform() {}
}
15 changes: 6 additions & 9 deletions guava/src/com/google/common/base/Platform.java
Expand Up @@ -14,9 +14,6 @@

package com.google.common.base;

import static com.google.common.base.Strings.lenientFormat;
import static java.lang.Boolean.parseBoolean;

import com.google.common.annotations.GwtCompatible;
import java.lang.ref.WeakReference;
import java.util.Locale;
Expand Down Expand Up @@ -98,22 +95,22 @@ public boolean isPcreLike() {
}
}

private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";

static void checkGwtRpcEnabled() {
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
String propertyName = "guava.gwt.emergency_reenable_rpc";

if (!Boolean.parseBoolean(System.getProperty(propertyName, "false"))) {
throw new UnsupportedOperationException(
lenientFormat(
Strings.lenientFormat(
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
+ " support by setting the system property %s to true. For more about system"
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
GWT_RPC_PROPERTY_NAME,
propertyName,
"https://stackoverflow.com/q/5189914/28465",
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
}
logger.log(
java.util.logging.Level.WARNING,
"In January 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
"Later in 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
+ " warning because you are sending a Guava type over GWT-RPC, which will break. You"
+ " can identify which type by looking at the class name in the attached stack trace.",
new Throwable());
Expand Down
15 changes: 6 additions & 9 deletions guava/src/com/google/common/collect/Platform.java
Expand Up @@ -16,9 +16,6 @@

package com.google.common.collect;

import static com.google.common.base.Strings.lenientFormat;
import static java.lang.Boolean.parseBoolean;

import com.google.common.annotations.GwtCompatible;
import java.lang.reflect.Array;
import java.util.Arrays;
Expand Down Expand Up @@ -115,22 +112,22 @@ static int reduceExponentIfGwt(int exponent) {
return exponent;
}

private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";

static void checkGwtRpcEnabled() {
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
String propertyName = "guava.gwt.emergency_reenable_rpc";

if (!Boolean.parseBoolean(System.getProperty(propertyName, "false"))) {
throw new UnsupportedOperationException(
lenientFormat(
com.google.common.base.Strings.lenientFormat(
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
+ " support by setting the system property %s to true. For more about system"
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
GWT_RPC_PROPERTY_NAME,
propertyName,
"https://stackoverflow.com/q/5189914/28465",
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
}
logger.log(
java.util.logging.Level.WARNING,
"In January 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
"Later in 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
+ " warning because you are sending a Guava type over GWT-RPC, which will break. You"
+ " can identify which type by looking at the class name in the attached stack trace.",
new Throwable());
Expand Down
15 changes: 6 additions & 9 deletions guava/src/com/google/common/primitives/Platform.java
Expand Up @@ -14,9 +14,6 @@

package com.google.common.primitives;

import static com.google.common.base.Strings.lenientFormat;
import static java.lang.Boolean.parseBoolean;

import com.google.common.annotations.GwtCompatible;

/** Methods factored out so that they can be emulated differently in GWT. */
Expand All @@ -25,22 +22,22 @@ final class Platform {
private static final java.util.logging.Logger logger =
java.util.logging.Logger.getLogger(Platform.class.getName());

private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";

static void checkGwtRpcEnabled() {
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
String propertyName = "guava.gwt.emergency_reenable_rpc";

if (!Boolean.parseBoolean(System.getProperty(propertyName, "false"))) {
throw new UnsupportedOperationException(
lenientFormat(
com.google.common.base.Strings.lenientFormat(
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
+ " support by setting the system property %s to true. For more about system"
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
GWT_RPC_PROPERTY_NAME,
propertyName,
"https://stackoverflow.com/q/5189914/28465",
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
}
logger.log(
java.util.logging.Level.WARNING,
"In January 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
"Later in 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
+ " warning because you are sending a Guava type over GWT-RPC, which will break. You"
+ " can identify which type by looking at the class name in the attached stack trace.",
new Throwable());
Expand Down

0 comments on commit 5214a10

Please sign in to comment.