Skip to content

Commit

Permalink
Merge branch 'main' into 9727-jakarta-servlet-support
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Sep 27, 2023
2 parents 25c2daf + 88bc805 commit 50ce8ff
Show file tree
Hide file tree
Showing 27 changed files with 1,533 additions and 29 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@

`$ ant clean dist-dev`

or if you don't have `python` and `g++` just run

`$ ant clean dist-dev`

Then you will get all `.jar` files in the folder `build/lib` and
the redistributable file will be: `build/dist/gwt-0.0.0.zip`

Expand Down
6 changes: 5 additions & 1 deletion build_tools/doctool/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<import file="${gwt.root}/common.ant.xml" />

<target name="compile" description="Compiles this project">
<gwt.javac />
<!--
As guarded below in the build target, doctool can't be built on
Java 8. In theory release could be set to 9, but 9 and 10 are EOL.
-->
<gwt.javac release="11" />
</target>

<target name="build" depends="compile" description="Packages this project into a jar" unless="${isJava8}">
Expand Down
8 changes: 3 additions & 5 deletions common.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
<property name="javac.debug" value="true"/>
<property name="javac.debuglevel" value="lines,vars,source"/>
<property name="javac.encoding" value="utf-8"/>
<property name="javac.source" value="8"/>
<property name="javac.target" value="8"/>
<property name="javac.release" value="8"/>
<property name="javac.nowarn" value="true"/>

<!-- javac and errorprone instructions from https://errorprone.info/docs/installation#ant -->
Expand Down Expand Up @@ -158,8 +157,7 @@
<macrodef name="gwt.javac">
<attribute name="srcdir" default="src" />
<attribute name="destdir" default="${javac.out}" />
<attribute name="source" default="${javac.source}" />
<attribute name="target" default="${javac.target}" />
<attribute name="release" default="${javac.release}" />
<attribute name="excludes" default="" />
<attribute name="processorpath" default="" />
<attribute name="errorprone.args" default="" />
Expand All @@ -172,7 +170,7 @@
</path>
<mkdir dir="@{destdir}"/>
<javac srcdir="@{srcdir}" sourcepath="@{srcdir}" destdir="@{destdir}" debug="${javac.debug}"
debuglevel="${javac.debuglevel}" source="@{source}" target="@{target}"
debuglevel="${javac.debuglevel}" source="@{release}" target="@{release}" release="@{release}"
nowarn="${javac.nowarn}" encoding="${javac.encoding}" includeantruntime="false"
fork="true" compiler="modern" excludes="@{excludes}">
<compilerarg value="-J-Xbootclasspath/p:${errorprone.javac.jar}" if:true="${isJava8}"/>
Expand Down
3 changes: 2 additions & 1 deletion doc/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<property file="${gwt.root}/build/out/packages.properties" />
<javadoc classpathref="DOC_PATH" failonerror="true" maxmemory="1g"
destdir="${project.build}/javadoc"
source="${javac.release}"
encoding="UTF-8"
access="package"
packagenames="${USER_PKGS}"
Expand Down Expand Up @@ -143,7 +144,7 @@
sourcepath="${gwt.root}/user/super/com/google/gwt/emul:${gwt.root}/dev/core/super/com/google/gwt/dev/jjs/intrinsic"
encoding="UTF-8"
access="public"
source="${javac.source}"
source="${javac.release}"
packagenames="${JAVA_PKGS}"
docletpath="${project.build}/../build_tools/doctool/bin"
doclet="com.google.doctool.custom.JavaEmulSummaryDoclet">
Expand Down
47 changes: 39 additions & 8 deletions user/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
<property name="emma.merged.out" value="${junit.out}/emma-coverage"/>

<property name="gwt.junit.testcase.web.includes" value="${gwt.junit.testcase.includes}"/>
<!-- TODO once we compile with Java >8, update this to exclude tests based on running JDK version -->
<condition property="gwt.junit.testcase.web.excludes"
value="**/*JreSuite.class,**/OptimizedOnly*,**/*Java8Suite.class"
else="**/*JreSuite.class,**/OptimizedOnly*,**/*Java8Suite.class">
value="**/*JreSuite.class,**/OptimizedOnly*"
else="**/*JreSuite.class,**/OptimizedOnly*,**/*Java9Suite.class,**/*Java10Suite.class,**/*Java11Suite.class">
<isfalse value="${isJava8}" />
</condition>

Expand All @@ -31,10 +30,9 @@
</condition>

<property name="gwt.junit.testcase.dev.includes" value="${gwt.junit.testcase.includes}"/>
<!-- TODO once we compile with Java >8, update this to exclude tests based on running JDK version -->
<condition property="gwt.junit.testcase.dev.excludes"
value="**/EmulSuite.class,**/JSONSuite.class,**/RunAsyncSuite.class,**/*CompilerSuite.class,**/*JsInteropSuite.class,**/*JreSuite.class,**/OptimizedOnly*,**/*Java8Suite.class"
else="**/EmulSuite.class,**/JSONSuite.class,**/RunAsyncSuite.class,**/*CompilerSuite.class,**/*JsInteropSuite.class,**/*JreSuite.class,**/OptimizedOnly*,**/*Java8Suite.class">
value="**/EmulSuite.class,**/JSONSuite.class,**/RunAsyncSuite.class,**/*CompilerSuite.class,**/*JsInteropSuite.class,**/*JreSuite.class,**/OptimizedOnly*"
else="**/EmulSuite.class,**/JSONSuite.class,**/RunAsyncSuite.class,**/*CompilerSuite.class,**/*JsInteropSuite.class,**/*JreSuite.class,**/OptimizedOnly*,**/*Java9Suite.class,**/*Java10Suite.class,**/*Java11Suite.class">
<isfalse value="${isJava8}" />
</condition>

Expand Down Expand Up @@ -298,13 +296,13 @@
Compiles the test code for this project
-->
<target name="compile.tests"
depends="-compile.tests.java8"
depends="-compile.tests.java8,-compile.tests.java11"
unless="compile.tests.complete">
</target>

<target name="-compile.tests.java8" depends="compile.dev.tests, compile.emma.if.enabled">
<gwt.javac srcdir="test" destdir="${javac.junit.out}"
excludes="com/google/gwt/langtest/**,**/super/**"
excludes="com/google/gwt/langtest/**,**/super/**,**/java9/**,**/*Java9*.java,**/java10/**,**/*Java10*.java,**/java11/**,**/*Java11*.java"
processorpath="test.extraclasspath"
errorprone.args="
-Xep:SelfAssignment:OFF
Expand Down Expand Up @@ -334,6 +332,39 @@
<compilerarg value="com.google.web.bindery.requestfactory.apt.RfValidator"/>
</gwt.javac>
</target>
<target name="-compile.tests.java11" unless="isJava8" depends="-compile.tests.java8">
<gwt.javac srcdir="test" destdir="${javac.junit.out}"
excludes="com/google/gwt/langtest/**,**/super/**"
processorpath="test.extraclasspath"
release="11"
errorprone.args="
-Xep:SelfAssignment:OFF
-Xep:MissingCasesInEnumSwitch:OFF
-Xep:SelfComparison:OFF
-Xep:SelfEquals:OFF
-Xep:FallThrough:OFF
-Xep:ReturnValueIgnored:OFF
-Xep:EqualsIncompatibleType:OFF
-Xep:IdentityBinaryExpression:OFF
-Xep:LoopConditionChecker:OFF
-Xep:JUnitAssertSameCheck:OFF
-Xep:CollectionIncompatibleType:OFF
-Xep:DeadThread:OFF
-Xep:ComplexBooleanConstant:OFF
-Xep:ComparableType:OFF
-Xep:DoNotCall:OFF
-Xep:BadAnnotationImplementation:OFF
">
<classpath>
<pathelement location="${javac.junit.out}"/>
<pathelement location="${javac.out}"/>
<pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar"/>
<pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar"/>
<path refid="test.extraclasspath"/>
</classpath>
</gwt.javac>

</target>

<target name="build" depends="compile, compile-jakarta"
description="Build and package this project">
Expand Down
80 changes: 80 additions & 0 deletions user/super/com/google/gwt/emul/java/util/List.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static javaemul.internal.InternalPreconditions.checkNotNull;

import java.util.function.UnaryOperator;
import javaemul.internal.ArrayHelper;

import jsinterop.annotations.JsIgnore;
import jsinterop.annotations.JsMethod;
Expand All @@ -34,6 +35,85 @@
@JsType
public interface List<E> extends Collection<E> {

@JsIgnore
static <E> List<E> of() {
return Collections.unmodifiableList(Collections.emptyList());
}

@JsIgnore
static <E> List<E> of(E e1) {
return __ofInternal((E[]) new Object[] {e1});
}

@JsIgnore
static <E> List<E> of(E e1, E e2) {
return __ofInternal((E[]) new Object[] {e1, e2});
}

@JsIgnore
static <E> List<E> of(E e1, E e2, E e3) {
return __ofInternal((E[]) new Object[] {e1, e2, e3});
}

@JsIgnore
static <E> List<E> of(E e1, E e2, E e3, E e4) {
return __ofInternal((E[]) new Object[] {e1, e2, e3, e4});
}

@JsIgnore
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5) {
return __ofInternal((E[]) new Object[] {e1, e2, e3, e4, e5});
}

@JsIgnore
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6) {
return __ofInternal((E[]) new Object[] {e1, e2, e3, e4, e5, e6});
}

@JsIgnore
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
return __ofInternal((E[]) new Object[] {e1, e2, e3, e4, e5, e6, e7});
}

@JsIgnore
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) {
return __ofInternal((E[]) new Object[] {e1, e2, e3, e4, e5, e6, e7, e8});
}

@JsIgnore
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) {
return __ofInternal((E[]) new Object[] {e1, e2, e3, e4, e5, e6, e7, e8, e9});
}

@JsIgnore
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) {
return __ofInternal((E[]) new Object[] {e1, e2, e3, e4, e5, e6, e7, e8, e9, e10});
}

// CHECKSTYLE_OFF: Internal only method that cannot collide with future JRE changes
/**
* Internal-only helper to avoid copying the incoming array, and instead just wrap it with an
* immutable List after checking there are no nulls.
*/
@JsIgnore
static <E> List<E> __ofInternal(E[] elements) {
for (int i = 0; i < elements.length; i++) {
checkNotNull(elements[i]);
}
return Collections.unmodifiableList(Arrays.asList(elements));
}
// CHECKSTYLE_ON

@JsIgnore
static <E> List<E> of(E... elements) {
for (int i = 0; i < elements.length; i++) {
checkNotNull(elements[i]);
}
return Collections.unmodifiableList(
Arrays.asList((E[]) ArrayHelper.unsafeClone(elements, 0, elements.length))
);
}

@JsMethod(name = "addAtIndex")
void add(int index, E element);

Expand Down
Loading

0 comments on commit 50ce8ff

Please sign in to comment.