001/*
002 * Copyright (C) 2009 The Guava Authors
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005 * in compliance with the License. You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software distributed under the License
010 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011 * or implied. See the License for the specific language governing permissions and limitations under
012 * the License.
013 */
014
015package com.google.common.annotations;
016
017import java.lang.annotation.Documented;
018import java.lang.annotation.ElementType;
019import java.lang.annotation.Retention;
020import java.lang.annotation.RetentionPolicy;
021import java.lang.annotation.Target;
022
023/**
024 * The presence of this annotation on a type indicates that the type may be used with <a
025 * href="https://www.gwtproject.org/">GWT</a> or <a href="https://github.com/google/j2cl">J2CL</a>.
026 *
027 * <p>Note that a {@code GwtCompatible} type may have some {@link GwtIncompatible} methods.
028 *
029 * @author Charles Fry
030 * @author Hayward Chan
031 */
032@Retention(RetentionPolicy.CLASS)
033@Target({ElementType.TYPE, ElementType.METHOD})
034@Documented
035@GwtCompatible
036public @interface GwtCompatible {
037
038  /**
039   * Obsolete; formerly used to indicate when a value was GWT serializable back before Guava dropped
040   * support for GWT serialization.
041   *
042   * @see <a href=
043   *     "https://www.gwtproject.org/doc/latest/DevGuideServerCommunication#DevGuideSerializableTypes">
044   *     Documentation about GWT serialization</a>
045   */
046  boolean serializable() default false;
047
048  /**
049   * When {@code true}, the annotated type is emulated in GWT. The emulated source (also known as
050   * super-source) is different from the implementation used by the JVM.
051   *
052   * @see <a href=
053   *     "https://www.gwtproject.org/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules">
054   *     Documentation about GWT emulated source</a>
055   */
056  boolean emulated() default false;
057}