1 /* 2 * Copyright (C) 2019 The Guava Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 * in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the License 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 * or implied. See the License for the specific language governing permissions and limitations under 12 * the License. 13 */ 14 15 package com.google.common.primitives; 16 17 import com.google.common.annotations.GwtCompatible; 18 19 /** Methods factored out so that they can be emulated differently in GWT. */ 20 @GwtCompatible(emulated = true) 21 final class Platform { 22 private static final java.util.logging.Logger logger = 23 java.util.logging.Logger.getLogger(Platform.class.getName()); 24 checkGwtRpcEnabled()25 static void checkGwtRpcEnabled() { 26 String propertyName = "guava.gwt.emergency_reenable_rpc"; 27 28 if (!Boolean.parseBoolean(System.getProperty(propertyName, "false"))) { 29 throw new UnsupportedOperationException( 30 com.google.common.base.Strings.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 propertyName, 35 "https://stackoverflow.com/q/5189914/28465", 36 "https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ")); 37 } 38 logger.log( 39 java.util.logging.Level.WARNING, 40 "Later in 2020, we will remove GWT-RPC support for Guava types. You are seeing this" 41 + " warning because you are sending a Guava type over GWT-RPC, which will break. You" 42 + " can identify which type by looking at the class name in the attached stack trace.", 43 new Throwable()); 44 45 } 46 Platform()47 private Platform() {} 48 } 49