Skip to content

Commit 5214a10

Browse files
cpovirknetdpb
authored andcommitted
Disable GWT-RPC by default in the open-source release.
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
1 parent 682a25f commit 5214a10

File tree

6 files changed

+21
-78
lines changed

6 files changed

+21
-78
lines changed

android/guava/src/com/google/common/base/Platform.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
package com.google.common.base;
1616

17-
import static com.google.common.base.Strings.lenientFormat;
18-
import static java.lang.Boolean.parseBoolean;
19-
2017
import com.google.common.annotations.GwtCompatible;
2118
import java.lang.ref.WeakReference;
2219
import java.util.Locale;
@@ -103,18 +100,5 @@ public boolean isPcreLike() {
103100
}
104101
}
105102

106-
private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";
107-
108-
static void checkGwtRpcEnabled() {
109-
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
110-
throw new UnsupportedOperationException(
111-
lenientFormat(
112-
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
113-
+ " support by setting the system property %s to true. For more about system"
114-
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
115-
GWT_RPC_PROPERTY_NAME,
116-
"https://stackoverflow.com/q/5189914/28465",
117-
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
118-
}
119-
}
103+
static void checkGwtRpcEnabled() {}
120104
}

android/guava/src/com/google/common/collect/Platform.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
package com.google.common.collect;
1818

19-
import static com.google.common.base.Strings.lenientFormat;
20-
import static java.lang.Boolean.parseBoolean;
21-
2219
import com.google.common.annotations.GwtCompatible;
2320
import java.lang.reflect.Array;
2421
import java.util.Arrays;
@@ -112,20 +109,7 @@ static int reduceExponentIfGwt(int exponent) {
112109
return exponent;
113110
}
114111

115-
private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";
116-
117-
static void checkGwtRpcEnabled() {
118-
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
119-
throw new UnsupportedOperationException(
120-
lenientFormat(
121-
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
122-
+ " support by setting the system property %s to true. For more about system"
123-
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
124-
GWT_RPC_PROPERTY_NAME,
125-
"https://stackoverflow.com/q/5189914/28465",
126-
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
127-
}
128-
}
112+
static void checkGwtRpcEnabled() {}
129113

130114
private Platform() {}
131115
}

android/guava/src/com/google/common/primitives/Platform.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,12 @@
1414

1515
package com.google.common.primitives;
1616

17-
import static com.google.common.base.Strings.lenientFormat;
18-
import static java.lang.Boolean.parseBoolean;
19-
2017
import com.google.common.annotations.GwtCompatible;
2118

2219
/** Methods factored out so that they can be emulated differently in GWT. */
2320
@GwtCompatible(emulated = true)
2421
final class Platform {
25-
private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";
26-
27-
static void checkGwtRpcEnabled() {
28-
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
29-
throw new UnsupportedOperationException(
30-
lenientFormat(
31-
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
32-
+ " support by setting the system property %s to true. For more about system"
33-
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
34-
GWT_RPC_PROPERTY_NAME,
35-
"https://stackoverflow.com/q/5189914/28465",
36-
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
37-
}
38-
}
22+
static void checkGwtRpcEnabled() {}
3923

4024
private Platform() {}
4125
}

guava/src/com/google/common/base/Platform.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
package com.google.common.base;
1616

17-
import static com.google.common.base.Strings.lenientFormat;
18-
import static java.lang.Boolean.parseBoolean;
19-
2017
import com.google.common.annotations.GwtCompatible;
2118
import java.lang.ref.WeakReference;
2219
import java.util.Locale;
@@ -98,22 +95,22 @@ public boolean isPcreLike() {
9895
}
9996
}
10097

101-
private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";
102-
10398
static void checkGwtRpcEnabled() {
104-
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
99+
String propertyName = "guava.gwt.emergency_reenable_rpc";
100+
101+
if (!Boolean.parseBoolean(System.getProperty(propertyName, "false"))) {
105102
throw new UnsupportedOperationException(
106-
lenientFormat(
103+
Strings.lenientFormat(
107104
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
108105
+ " support by setting the system property %s to true. For more about system"
109106
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
110-
GWT_RPC_PROPERTY_NAME,
107+
propertyName,
111108
"https://stackoverflow.com/q/5189914/28465",
112109
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
113110
}
114111
logger.log(
115112
java.util.logging.Level.WARNING,
116-
"In January 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
113+
"Later in 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
117114
+ " warning because you are sending a Guava type over GWT-RPC, which will break. You"
118115
+ " can identify which type by looking at the class name in the attached stack trace.",
119116
new Throwable());

guava/src/com/google/common/collect/Platform.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
package com.google.common.collect;
1818

19-
import static com.google.common.base.Strings.lenientFormat;
20-
import static java.lang.Boolean.parseBoolean;
21-
2219
import com.google.common.annotations.GwtCompatible;
2320
import java.lang.reflect.Array;
2421
import java.util.Arrays;
@@ -115,22 +112,22 @@ static int reduceExponentIfGwt(int exponent) {
115112
return exponent;
116113
}
117114

118-
private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";
119-
120115
static void checkGwtRpcEnabled() {
121-
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
116+
String propertyName = "guava.gwt.emergency_reenable_rpc";
117+
118+
if (!Boolean.parseBoolean(System.getProperty(propertyName, "false"))) {
122119
throw new UnsupportedOperationException(
123-
lenientFormat(
120+
com.google.common.base.Strings.lenientFormat(
124121
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
125122
+ " support by setting the system property %s to true. For more about system"
126123
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
127-
GWT_RPC_PROPERTY_NAME,
124+
propertyName,
128125
"https://stackoverflow.com/q/5189914/28465",
129126
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
130127
}
131128
logger.log(
132129
java.util.logging.Level.WARNING,
133-
"In January 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
130+
"Later in 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
134131
+ " warning because you are sending a Guava type over GWT-RPC, which will break. You"
135132
+ " can identify which type by looking at the class name in the attached stack trace.",
136133
new Throwable());

guava/src/com/google/common/primitives/Platform.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
package com.google.common.primitives;
1616

17-
import static com.google.common.base.Strings.lenientFormat;
18-
import static java.lang.Boolean.parseBoolean;
19-
2017
import com.google.common.annotations.GwtCompatible;
2118

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

28-
private static final String GWT_RPC_PROPERTY_NAME = "guava.gwt.emergency_reenable_rpc";
29-
3025
static void checkGwtRpcEnabled() {
31-
if (!parseBoolean(System.getProperty(GWT_RPC_PROPERTY_NAME, "true"))) {
26+
String propertyName = "guava.gwt.emergency_reenable_rpc";
27+
28+
if (!Boolean.parseBoolean(System.getProperty(propertyName, "false"))) {
3229
throw new UnsupportedOperationException(
33-
lenientFormat(
30+
com.google.common.base.Strings.lenientFormat(
3431
"We are removing GWT-RPC support for Guava types. You can temporarily reenable"
3532
+ " support by setting the system property %s to true. For more about system"
3633
+ " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
37-
GWT_RPC_PROPERTY_NAME,
34+
propertyName,
3835
"https://stackoverflow.com/q/5189914/28465",
3936
"https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
4037
}
4138
logger.log(
4239
java.util.logging.Level.WARNING,
43-
"In January 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
40+
"Later in 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
4441
+ " warning because you are sending a Guava type over GWT-RPC, which will break. You"
4542
+ " can identify which type by looking at the class name in the attached stack trace.",
4643
new Throwable());

0 commit comments

Comments
 (0)