Move jsinterop-annotations source code out of GWT. jsinterop-annotations has its own repo on github. This CL removes the code from the gwt repo and add a dependency to the jar file now present in tools repo. The gwt-user.jar distributed in the zip will still contain these classes, but the maven version will correctly reference the jar already present in maven central. Change-Id: I5c341e1ae5ad48ea3bf8104d781b1d16fccdef4a
diff --git a/maven/lib-gwt.sh b/maven/lib-gwt.sh index e8bad8c..8d504db 100644 --- a/maven/lib-gwt.sh +++ b/maven/lib-gwt.sh
@@ -36,8 +36,6 @@ function maven-gwt() { local gwtMavenVersion=$1 shift - local jsinteropMavenVersion=$1 - shift local gwtSdkArchive=$1 shift local mavenRepoUrl=$1 @@ -69,16 +67,12 @@ JAVADOC_FILE_PATH=$RANDOM_DIR/gwt-javadoc.jar [ -d $GWT_EXTRACT_DIR/doc/javadoc ] && jar cf $JAVADOC_FILE_PATH -C $GWT_EXTRACT_DIR/doc/javadoc . - # Create a dummy javadoc JAR for JsInterop (gwt-javadoc is too heavy) - JSINTEROP_JAVADOC_FILE_PATH=$RANDOM_DIR/jsinterop-javadoc.jar - jar cf $JSINTEROP_JAVADOC_FILE_PATH -C $pomDir/jsinterop README.javadoc - # Generate POMs with correct version for template in `find $pomDir -name pom-template.xml` do dir=`dirname $template` pushd $dir > /dev/null - sed -e "s|\${gwtVersion}|$gwtMavenVersion|g" -e "s|\${jsinteropVersion}|$jsinteropMavenVersion|g" pom-template.xml >pom.xml + sed -e "s|\${gwtVersion}|$gwtMavenVersion|g" pom-template.xml >pom.xml popd > /dev/null done @@ -88,24 +82,6 @@ gwtLibs="${gwtLibs} elemental" fi - jsinteropLibs='annotations' - - # Create jsinterop libs - for i in $jsinteropLibs - do - echo "Creating jsinterop-${i}.jar and jsinterop-${i}-sources.jar" - zip $GWT_EXTRACT_DIR/gwt-user.jar --copy --out $GWT_EXTRACT_DIR/jsinterop-${i}.jar \ - "jsinterop/${i}/*" - zip -d $GWT_EXTRACT_DIR/jsinterop-${i}.jar \ - "jsinterop/${i}/*.java" "jsinterop/${i}/*.gwt.xml" - zip $GWT_EXTRACT_DIR/gwt-user.jar --copy --out $GWT_EXTRACT_DIR/jsinterop-${i}-sources.jar \ - "jsinterop/${i}/*.java" "jsinterop/${i}/*.gwt.xml" - echo "Removing jsinterop/${i} from gwt-user" - zip -d $GWT_EXTRACT_DIR/gwt-user.jar "jsinterop/${i}/*" - echo "Removing jsinterop/${i} from gwt-servlet" - zip -d $GWT_EXTRACT_DIR/gwt-servlet.jar "jsinterop/${i}/*" - done - echo "Removing bundled third-parties from gwt-dev" zip -q $GWT_EXTRACT_DIR/gwt-dev.jar --copy --out $GWT_EXTRACT_DIR/gwt-dev-trimmed.jar \ "com/google/gwt/*" "org/eclipse/jdt/*" @@ -165,15 +141,5 @@ || die done - # Deploy jsInterop jars - maven-deploy-file $mavenRepoUrl $mavenRepoId $pomDir/jsinterop/pom.xml $pomDir/jsinterop/pom.xml || die - - for i in $jsinteropLibs - do - maven-deploy-file $mavenRepoUrl $mavenRepoId $GWT_EXTRACT_DIR/jsinterop-${i}.jar $pomDir/jsinterop/${i}/pom.xml \ - $JSINTEROP_JAVADOC_FILE_PATH $GWT_EXTRACT_DIR/jsinterop-${i}-sources.jar \ - || die - done - finishAndCleanup }
diff --git a/maven/poms/gwt/gwt-user/pom-template.xml b/maven/poms/gwt/gwt-user/pom-template.xml index db10249..e9fa33c 100644 --- a/maven/poms/gwt/gwt-user/pom-template.xml +++ b/maven/poms/gwt/gwt-user/pom-template.xml
@@ -18,11 +18,6 @@ <artifactId>jsinterop-annotations</artifactId> </dependency> <dependency> - <groupId>com.google.jsinterop</groupId> - <artifactId>jsinterop-annotations</artifactId> - <classifier>sources</classifier> - </dependency> - <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> </dependency>
diff --git a/maven/poms/gwt/pom-template.xml b/maven/poms/gwt/pom-template.xml index 8b1d89c..78d3e05 100644 --- a/maven/poms/gwt/pom-template.xml +++ b/maven/poms/gwt/pom-template.xml
@@ -60,10 +60,8 @@ </dependency> <dependency> <groupId>com.google.jsinterop</groupId> - <artifactId>jsinterop</artifactId> - <version>${jsinteropVersion}</version> - <type>pom</type> - <scope>import</scope> + <artifactId>jsinterop-annotations</artifactId> + <version>2.0.0</version> </dependency> <dependency> <groupId>javax.servlet</groupId>
diff --git a/maven/poms/jsinterop/README.javadoc b/maven/poms/jsinterop/README.javadoc deleted file mode 100644 index 6994981..0000000 --- a/maven/poms/jsinterop/README.javadoc +++ /dev/null
@@ -1,5 +0,0 @@ -This is an empty javadoc JAR in accordance with -http://central.sonatype.org/pages/requirements.html - -Please refer to the sources for documentation, -or the com.google.gwt:gwt-user javadoc.
diff --git a/maven/poms/jsinterop/annotations/pom-template.xml b/maven/poms/jsinterop/annotations/pom-template.xml deleted file mode 100644 index f7d31d4..0000000 --- a/maven/poms/jsinterop/annotations/pom-template.xml +++ /dev/null
@@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>com.google.jsinterop</groupId> - <artifactId>jsinterop</artifactId> - <version>${jsinteropVersion}</version> - </parent> - <groupId>com.google.jsinterop</groupId> - <artifactId>jsinterop-annotations</artifactId> - <packaging>jar</packaging> - <version>${jsinteropVersion}</version> -</project>
diff --git a/maven/poms/jsinterop/pom-template.xml b/maven/poms/jsinterop/pom-template.xml deleted file mode 100644 index fe7ec80..0000000 --- a/maven/poms/jsinterop/pom-template.xml +++ /dev/null
@@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>org.sonatype.oss</groupId> - <artifactId>oss-parent</artifactId> - <version>4</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <groupId>com.google.jsinterop</groupId> - <artifactId>jsinterop</artifactId> - <packaging>pom</packaging> - <name>JsInterop</name> - <url>http://www.gwtproject.org/</url> - <version>${jsinteropVersion}</version> - <licenses> - <license> - <name>GWT Terms</name> - <url>http://www.gwtproject.org/terms.html</url> - </license> - </licenses> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>com.google.jsinterop</groupId> - <artifactId>jsinterop-annotations</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.google.jsinterop</groupId> - <artifactId>jsinterop-annotations</artifactId> - <version>${project.version}</version> - <classifier>sources</classifier> - </dependency> - </dependencies> - </dependencyManagement> -</project>
diff --git a/maven/push-gwt.sh b/maven/push-gwt.sh index 801666a..36b58a7 100755 --- a/maven/push-gwt.sh +++ b/maven/push-gwt.sh
@@ -35,7 +35,6 @@ # use GWT_VERSION to specify the default version or get it from the file name gwtVersionDefault=${GWT_VERSION:=$(expr "$gwtPathDefault" : '.*gwt-\('$VERSION_REGEX'\)\.zip')} -jsinteropVersionDefault=${JSINTEROP_VERSION:=HEAD-SNAPSHOT} # prompt for info read -e -p"GWT version for Maven (${gwtVersionDefault:-ex: HEAD-SNAPSHOT}): " gwtVersion @@ -45,13 +44,6 @@ exit 1 fi -read -e -p"JsInterop version for Maven (${jsinteropVersionDefault:-ex: HEAD-SNAPSHOT}): " jsinteropVersion -jsinteropVersion=${jsinteropVersion:=$jsinteropVersionDefault} -if test "$jsinteropVersion" != "HEAD-SNAPSHOT" && ! expr "$jsinteropVersion" : "$VERSION_REGEX" >/dev/null; then - echo "Please enter a version of the form x.y.z or x.y.z-abc" - exit 1 -fi - read -e -p"Path to GWT distro zip $gwtPathPrompt: " gwtPath gwtPath=${gwtPath:=$gwtPathDefault} if [[ ! -f $gwtPath ]]; then @@ -73,7 +65,6 @@ gpgPassphrase=${gpgPassphrase:=$GWT_GPG_PASS} maven-gwt "$gwtVersion" \ - "$jsinteropVersion" \ "$gwtPath" \ "$repoUrl" \ "$repoId"
diff --git a/user/build.xml b/user/build.xml index 3d2a256..d164639 100755 --- a/user/build.xml +++ b/user/build.xml
@@ -126,6 +126,8 @@ location="${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final-sources.jar"/> <pathelement location="${gwt.tools.lib}/streamhtmlparser/streamhtmlparser-jsilver-r10/streamhtmlparser-jsilver-r10-1.5-rebased.jar"/> + <pathelement + location="${gwt.tools.lib}/jsinterop/jsinterop-annotations-2.0.0.jar"/> <pathelement location="${gwt.dev.jar}"/> </classpath> </gwt.javac> @@ -206,6 +208,7 @@ <zipfileset src="${gwt.tools.lib}/streamhtmlparser/streamhtmlparser-jsilver-r10/streamhtmlparser-jsilver-r10-1.5-rebased.jar"/> <zipfileset src="${gwt.tools.lib}/gss/2015-11-04/closure-stylesheets-library-20151104-rebased.jar"/> + <zipfileset src="${gwt.tools.lib}/jsinterop/jsinterop-annotations-2.0.0.jar"/> </gwt.jar> </target>
diff --git a/user/src/com/google/gwt/core/Core.gwt.xml b/user/src/com/google/gwt/core/Core.gwt.xml index 5569fe4..d910889 100644 --- a/user/src/com/google/gwt/core/Core.gwt.xml +++ b/user/src/com/google/gwt/core/Core.gwt.xml
@@ -38,7 +38,6 @@ <inherits name="com.google.gwt.emul.Emulation" /> <inherits name="com.google.gwt.core.StackTrace" /> <inherits name="com.google.gwt.core.AsyncFragmentLoader" /> - <inherits name="jsinterop.annotations.Annotations" /> <source path="client" /> <source path="shared" />
diff --git a/user/src/jsinterop/annotations/Annotations.gwt.xml b/user/src/jsinterop/annotations/Annotations.gwt.xml deleted file mode 100644 index 2b4b77e..0000000 --- a/user/src/jsinterop/annotations/Annotations.gwt.xml +++ /dev/null
@@ -1,3 +0,0 @@ -<module> - <source path="" /> -</module>
diff --git a/user/src/jsinterop/annotations/JsAsync.java b/user/src/jsinterop/annotations/JsAsync.java deleted file mode 100644 index 894856c..0000000 --- a/user/src/jsinterop/annotations/JsAsync.java +++ /dev/null
@@ -1,42 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsAsync marks a method to be transpiled to an async JavaScript method. - * - * <p>Adding this annotation to a method adds an {@code async} keyword to the generated JavaScript - * function. - * - * <p>There are some limitations apply on JsAsync to make the annotation practical: - * <ul> - * <li>A @JsAsync method return type should be IThenable or Promise. - * <li>A @JsAsync method should not return {@code null}. - * </ul> - * - * <p>This is an EXPERIMENTAL annotation and only works in J2CL. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Documented -public @interface JsAsync { -}
diff --git a/user/src/jsinterop/annotations/JsConstructor.java b/user/src/jsinterop/annotations/JsConstructor.java deleted file mode 100644 index f0152cc..0000000 --- a/user/src/jsinterop/annotations/JsConstructor.java +++ /dev/null
@@ -1,37 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsConstructor marks a constructor that will be translated into a JavaScript constructor function. - * - * <p>Due to ES6 class semantics, for non-native JsTypes only one JsConstructor is allowed to exist - * in the type which becomes the 'primary constructor'. All other constructors in the type must - * delegate to it. Subclasses of a type with JsConstructor should follow the same restriction with - * the exception that the primary constructor is not required to be marked as JsConstructor but - * still need to delegate to super primary constructor. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.CONSTRUCTOR) -@Documented -public @interface JsConstructor { -}
diff --git a/user/src/jsinterop/annotations/JsEnum.java b/user/src/jsinterop/annotations/JsEnum.java deleted file mode 100644 index 3332821..0000000 --- a/user/src/jsinterop/annotations/JsEnum.java +++ /dev/null
@@ -1,91 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsEnum marks a Java enum as being represented as a Closure enum, either one that already exists - * from the external JavaScript environment, or one that will be accessible from the external - * JavaScript environment. - * - * <p>The underlying type of the Closure enum can be specified via {@link #hasCustomValue} and - * declaring an instance field named "value" of the desired type. - * - * <p>If the JsEnum is non-native and has custom values, a constructor is required to allow - * specifying the values for the enum constants, as in the following example - * - * <pre><code> - * {@literal @}JsEnum(hasCustomValue=true) - * enum IntJsEnum { - * TEN(10), - * TWENTY(20); - * - * int value; - * - * IntJsEnum(int value) { this.value = value; } - * } - * </code></pre> - * - * <p>If the JsEnum is native and has custom values, the value field is still required but - * constructors are not needed nor allowed. - * - * <p>JsEnums do not support the full Java semantics: - * - * <ul> - * <li>No instance fields are allowed other than {@code value}, - * <li>{@link Enum#name()} and {@link Enum#values()} are not supported. - * <li>{@link Enum#ordinal()} is supported only for non-native JsEnums that don't have custom - * values. - * <li>The class is initialization might be delayed until a static field/method is accessed. - * </ul> - * - * <p>The JavaScript namespace and name can be specified in a manner similar to JsTypes via {@link - * #namespace} and {@link #name} respectively. - * - * <p>Methods and fields declared in the JsEnum are only accessible in Java code. Only the enum - * constants are accessible from JavaScript code. - * - * <p>This annotation is only supported by J2CL. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@Documented -public @interface JsEnum { - - /** - * Customizes the name of the type in generated JavaScript. If not provided, the simple Java name - * will be used. - */ - String name() default "<auto>"; - - /** Customizes the namespace of the type in generated JavaScript. */ - String namespace() default "<auto>"; - - /** When set to {@code true}, this JsEnum is a native Closure enum type. */ - boolean isNative() default false; - - /** - * When set to {@code true}, this JsEnum will have a custom value defined by a field named - * 'value'. The only allowed types for the value field are String and primitive types with the - * exception of long. - */ - boolean hasCustomValue() default false; -}
diff --git a/user/src/jsinterop/annotations/JsFunction.java b/user/src/jsinterop/annotations/JsFunction.java deleted file mode 100644 index 46aea7f..0000000 --- a/user/src/jsinterop/annotations/JsFunction.java +++ /dev/null
@@ -1,50 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsFunction marks a functional interface as being the definition of a JavaScript function. - * - * <p>There are some limitations exists on JsFunction to make them practical and efficient: - * - * <ul> - * <li>A JsFunction interface cannot extend any other interfaces. - * <li>A class may not implement more than one JsFunction interface. - * <li>A class that implements a JsFunction type cannot be a {@link JsType} (directly or - * indirectly). - * <li>Fields and defender methods of the interfaces should be marked with {@link JsOverlay} and - * cannot be overridden by the implementations. - * </ul> - * - * <p>As a best practice, we also recommend marking JsFunction interfaces with FunctionalInterface - * to get improved checking in IDEs. - * - * <p><b>Instanceof and Castability:</b> - * - * <p>Instanceof and casting for JsFunction is effectively a JavaScript <tt>'typeof'</tt> check to - * determine if the instance is a function. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@Documented -public @interface JsFunction { -}
diff --git a/user/src/jsinterop/annotations/JsIgnore.java b/user/src/jsinterop/annotations/JsIgnore.java deleted file mode 100644 index 2cd0591..0000000 --- a/user/src/jsinterop/annotations/JsIgnore.java +++ /dev/null
@@ -1,35 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Marks a member to be ignored for JsInterop purposes. - * - * <p>This is particularly useful when {@link JsType} is applied to a class and some members need - * to be ignored as they don't comply with restrictions (e.g. overloading) or shouldn't be exported - * for other reasons. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD}) -@Documented -public @interface JsIgnore { -}
diff --git a/user/src/jsinterop/annotations/JsMethod.java b/user/src/jsinterop/annotations/JsMethod.java deleted file mode 100644 index dee9892..0000000 --- a/user/src/jsinterop/annotations/JsMethod.java +++ /dev/null
@@ -1,47 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsMethod marks a method that will be directly translated into a JavaScript method preserving - * its name. - * <p> - * Note: In JavaScript, instance members are defined on the prototype and class members are defined - * on the constructor function of the type. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Documented -public @interface JsMethod { - - /** - * Customizes the name of the member in generated JavaScript. If not provided, the Java name will - * be used. - */ - String name() default "<auto>"; - - /** - * Customizes the namespace of the static member in generated JavaScript. If none is provided, - * namespace is the enclosing class' fully qualified JavaScript name. - */ - String namespace() default "<auto>"; -}
diff --git a/user/src/jsinterop/annotations/JsNonNull.java b/user/src/jsinterop/annotations/JsNonNull.java deleted file mode 100644 index 3872b0c..0000000 --- a/user/src/jsinterop/annotations/JsNonNull.java +++ /dev/null
@@ -1,38 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsNonNull marks a type as non-nullable indicating that program elements of such a type can not - * hold a {@code null} value. - * - * <p>Note that JsNonNull can only be used in a JsConstructor, a JsMethod, a JsProperty or a - * JsFunction method. - * - * <p>This annotation is informational in the GWT compiler but other compilers or tools might use it - * for example to annotate types in the output JavaScript program. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE_USE) -@Documented -public @interface JsNonNull { } -
diff --git a/user/src/jsinterop/annotations/JsNullable.java b/user/src/jsinterop/annotations/JsNullable.java deleted file mode 100644 index b19a1d4..0000000 --- a/user/src/jsinterop/annotations/JsNullable.java +++ /dev/null
@@ -1,37 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsNullable marks a type variable as nullable indicating that program elements of such a type can - * hold a {@code null} value. - * - * <p>Note that JsNullable can only be used on type variables in the context of a JsConstructor, - * a JsMethod, a JsProperty or a JsFunction method. - * - * <p>This annotation is informational in the GWT compiler but other compilers or tools might use it - * for example to annotate types in the output JavaScript program. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE_USE) -@Documented -public @interface JsNullable { }
diff --git a/user/src/jsinterop/annotations/JsOptional.java b/user/src/jsinterop/annotations/JsOptional.java deleted file mode 100644 index 5ff5f49..0000000 --- a/user/src/jsinterop/annotations/JsOptional.java +++ /dev/null
@@ -1,39 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsOptional marks a parameter in a method as optional indicating that the argument can be omitted - * from the function call when called from JavaScript side. - * - * <p>Note that JsOptional can only be used in a JsConstructor, a JsMethod or a JsFunction method. - * An optional argument cannot precede a non-optional argument (a vararg is considered an - * optional argument). - * - * <p>This annotation is informational in the GWT compiler but other compilers or tools might use it - * for example to annotate types in the output JavaScript program. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.PARAMETER) -@Documented -public @interface JsOptional { -}
diff --git a/user/src/jsinterop/annotations/JsOverlay.java b/user/src/jsinterop/annotations/JsOverlay.java deleted file mode 100644 index a69be34..0000000 --- a/user/src/jsinterop/annotations/JsOverlay.java +++ /dev/null
@@ -1,58 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsOverlay is used to enhance Java API of the native JsTypes and JsFunctions so richer and more - * Java friendly abstractions could be provided. - * - * <pre> - * {@literal @}JsType(isNative=true) - * class Person { - * {@literal @}JsOverlay - * private static final Person NO_BODY = new Person(); - * - * private String name; - * private String lastName; - * - * {@literal @}JsOverlay - * public String getFullName() { - * return (name + " " + lastName).trim(); - * } - * }</pre> - * - * <p>Note that: - * - * <ul> - * <li> JsOverlay methods cannot override any existing methods. - * <li> JsOverlay methods should be effectively final. - * <li> JsOverlay methods cannot be called from JavaScript - * </ul> - * - * These restrictions are in place to avoid polymorphism because underneath the original type is not - * modified and the overlay fields/methods are simply turned into static dispatches. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.METHOD, ElementType.FIELD}) -@Documented -public @interface JsOverlay { -}
diff --git a/user/src/jsinterop/annotations/JsPackage.java b/user/src/jsinterop/annotations/JsPackage.java deleted file mode 100644 index a8ea248..0000000 --- a/user/src/jsinterop/annotations/JsPackage.java +++ /dev/null
@@ -1,38 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Provides a default namespace for all @JsType classes in a package by applying to - * 'package-info.java'. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.PACKAGE) -@Documented -public @interface JsPackage { - /** - * Namespace of the global JavaScript object. - */ - String GLOBAL = "<global>"; - - String namespace(); -}
diff --git a/user/src/jsinterop/annotations/JsProperty.java b/user/src/jsinterop/annotations/JsProperty.java deleted file mode 100644 index 4c2fb17..0000000 --- a/user/src/jsinterop/annotations/JsProperty.java +++ /dev/null
@@ -1,65 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsProperty marks a field or method that is translated directly into a JavaScript property - * preserving its name. - * - * <p>If it is applied to a method, it will be treated as a property accessor. As a result, instead - * of translating method calls to JsProperty methods as method calls in JS, they will be translated - * as property lookups. When a JsProperty method implemented by a Java class, such methods will be - * generated as property accessor in JavaScript, hence the property access will trigger the - * execution of the matching getter or setter methods. - * - * <p>JsProperty follows JavaBean style naming convention to extract the default property name. If - * the JavaBean convention is not followed, the name should be set explicitly. For example: - * - * <ul> - * <li> {@code @JsProperty getX()} or {@code @JsProperty isX()} translates as <tt>this.x</tt> - * <li> {@code @JsProperty setX(int y)} translates as <tt>this.x=y</tt> - * </ul> - * - * <p>Note: In JavaScript, instance members are defined on the prototype and class members are - * defined on the constructor function of the type which mimics ES6 class style. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.METHOD, ElementType.FIELD}) -@Documented -public @interface JsProperty { - - /** - * Customizes the name of the member in generated JavaScript. If none is provided; - * - * <ul> - * <li>if it is field, the simple Java name will be used. - * <li>if it is a method, the name will be generated based on JavaBean conventions. - * </ul> - */ - String name() default "<auto>"; - - /** - * Customizes the namespace of the static member in generated JavaScript. If none is provided, - * namespace is the enclosing class' fully qualified JavaScript name. - */ - String namespace() default "<auto>"; -}
diff --git a/user/src/jsinterop/annotations/JsType.java b/user/src/jsinterop/annotations/JsType.java deleted file mode 100644 index fe11549..0000000 --- a/user/src/jsinterop/annotations/JsType.java +++ /dev/null
@@ -1,84 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package jsinterop.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * JsType is used to describe the JavaScript API of an object, either one that already exists from - * the external JavaScript environment, or one that will be accessible from the external JavaScript - * environment. - * - * <p>Marking an object with JsType is similar to marking each public member of the class with - * {@link JsProperty}/{@link JsMethod}/{@link JsConstructor} respectively. In order for this to work - * correctly the JavaScript name needs to be unique for each member. Some unobvious ways to cause - * name collisions are: - * - * <ul> - * <li>having method or constructor overloads - * <li>using the same name for a method and a field - * <li>shadowing a field from parent - * </ul> - * - * <p>Name collisions must be avoided by providing custom names (e.g. {@link JsProperty#name}) or by - * ignoring members using {@link JsIgnore}. - * - * <p>If the JsType is marked as "native" via {@link #isNative}, then the type is considered a stub - * for an existing class that is available in native JavaScript. Unlike non-native JsTypes, all - * members are considered {@link JsProperty}/{@link JsMethod}/{@link JsConstructor} unless they are - * explicitly marked with {@link JsOverlay}. - * - * <p> For native interfaces with no particular JavaScript type associated with them (e.g. - * structural types) it is recommeded to use {@code namespace = JsPackage.GLOBAL} and - * {@code name = '?'}. - * - * <p><b>Instanceof and Castability:</b> - * - * <p>If the JsType is native, the generated code will try to mimic Javascript semantics. - * - * <p>All non-native JsTypes will follow regular Java semantics in terms of castability. - * - * <ul> - * <li>For concrete native JsTypes, cast checks and instanceof checks will be delegated to the - * native JavaScript instanceof operator. - * <li>For interface native JsTypes, instanceof is forbidden and casts to them always succeed. - * </ul> - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@Documented -public @interface JsType { - - /** - * Customizes the name of the type in generated JavaScript. If not provided, the simple Java name - * will be used. - */ - String name() default "<auto>"; - - /** - * Customizes the namespace of the type in generated JavaScript. - */ - String namespace() default "<auto>"; - - /** - * Set to {@code true}, this JsType is a native JavaScript type. - */ - boolean isNative() default false; -}