Update JDT to version 3.13.0 and add Java 9 language features support.
Change-Id: I073275a065caec0510708bdc7bd63bc53953752a
diff --git a/dev/build.xml b/dev/build.xml
index 1908436..4b4663a 100755
--- a/dev/build.xml
+++ b/dev/build.xml
@@ -135,9 +135,9 @@
<zipfileset src="${gwt.tools.lib}/apache/ant-1.6.5.jar"/>
<zipfileset src="${gwt.tools.lib}/colt/colt-1.2.jar"/>
<zipfileset
- src="${gwt.tools.lib}/eclipse/org.eclipse.jdt.core_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
+ src="${gwt.tools.lib}/eclipse/org.eclipse.jdt.core_3.13.50.v20171007-0855.jar"/>
<zipfileset
- src="${gwt.tools.lib}/eclipse/jdtCompilerAdapter_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
+ src="${gwt.tools.lib}/eclipse/jdtCompilerAdapter_3.13.50.v20171007-0855.jar"/>
<zipfileset src="${gwt.tools.lib}/guava/guava-19.0/guava-19.0-rebased.jar"/>
<zipfileset src="${gwt.tools.lib}/icu4j/50.1.1/icu4j.jar"/>
<zipfileset
@@ -228,9 +228,9 @@
<pathelement
location="${gwt.tools.lib}/apache/commons/commons-collections-3.2.2.jar"/>
<pathelement
- location="${gwt.tools.lib}/eclipse/org.eclipse.jdt.core_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
+ location="${gwt.tools.lib}/eclipse/org.eclipse.jdt.core_3.13.50.v20171007-0855.jar"/>
<pathelement
- location="${gwt.tools.lib}/eclipse/jdtCompilerAdapter_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
+ location="${gwt.tools.lib}/eclipse/jdtCompilerAdapter_3.13.50.v20171007-0855.jar"/>
<pathelement
location="${gwt.tools.lib}/guava/guava-19.0/guava-19.0-rebased.jar"/>
<pathelement location="${gwt.tools.lib}/gson/gson-2.6.2.jar"/>
diff --git a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
index 4f2ffdd..88fc310 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
@@ -813,7 +813,8 @@
*/
private static final Map<SourceLevel, Long> jdtLevelByGwtLevel =
ImmutableMap.<SourceLevel, Long>of(
- SourceLevel.JAVA8, ClassFileConstants.JDK1_8);
+ SourceLevel.JAVA8, ClassFileConstants.JDK1_8,
+ SourceLevel.JAVA9, ClassFileConstants.JDK9);
public JdtCompiler(CompilerContext compilerContext, UnitProcessor processor) {
this.compilerContext = compilerContext;
diff --git a/dev/core/src/com/google/gwt/dev/javac/asm/ResolveTypeSignature.java b/dev/core/src/com/google/gwt/dev/javac/asm/ResolveTypeSignature.java
index 6aa3203..ed46c0a 100644
--- a/dev/core/src/com/google/gwt/dev/javac/asm/ResolveTypeSignature.java
+++ b/dev/core/src/com/google/gwt/dev/javac/asm/ResolveTypeSignature.java
@@ -218,7 +218,7 @@
JClassType[] typeArgs) {
int n = typeArgs.length;
for (int i = 0; i < n; ++i) {
- JWildcardType wildcard = typeArgs[i].isWildcard();
+ JWildcardType wildcard = typeArgs[i] == null ? null : typeArgs[i].isWildcard();
// right now we only replace Foo<?> with the constraints defined on the
// definition (which appears to match the existing TypeOracleUpdater)
// but other cases may need to be handled.
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
index ad4fb56..43138b0 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
@@ -1215,12 +1215,13 @@
// And its JInterface container we must implement
// There may be more than more JInterface containers to be implemented
// if the lambda expression is cast to a IntersectionCastType.
- JInterfaceType[] funcType;
+ JInterfaceType[] lambdaInterfaces;
if (binding instanceof IntersectionTypeBinding18) {
- funcType = processIntersectionTypeForLambda((IntersectionTypeBinding18) binding, blockScope,
- JdtUtil.signature(samBinding));
+ IntersectionTypeBinding18 type = (IntersectionTypeBinding18) binding;
+ lambdaInterfaces =
+ processIntersectionType(type, new JInterfaceType[type.intersectingTypes.length]);
} else {
- funcType = new JInterfaceType[] {(JInterfaceType) typeMap.get(binding)};
+ lambdaInterfaces = new JInterfaceType[] {(JInterfaceType) typeMap.get(binding)};
}
SourceInfo info = makeSourceInfo(x);
@@ -1228,8 +1229,8 @@
// class lambda$0$Type implements T {}
String innerLambdaImplementationClassShortName = String.valueOf(x.binding.selector);
- JClassType innerLambdaClass = createInnerClass(
- curClass.getClassOrInterface(), innerLambdaImplementationClassShortName, info, funcType);
+ JClassType innerLambdaClass = createInnerClass(curClass.getClassOrInterface(),
+ innerLambdaImplementationClassShortName, info, lambdaInterfaces);
JConstructor ctor = new JConstructor(info, innerLambdaClass, AccessModifier.PRIVATE);
// locals captured by the lambda and saved as fields on the anonymous inner class
@@ -2224,12 +2225,32 @@
List<JLocal> resourceVariables = Lists.newArrayList();
for (int i = x.resources.length - 1; i >= 0; i--) {
// Needs to iterate back to front to be inline with the contents of the stack.
+ Statement resource = x.resources[i];
+ JStatement resourceStatement = pop(resource);
- JDeclarationStatement resourceDecl = pop(x.resources[i]);
+ JLocal resourceVar;
+ if (resource instanceof LocalDeclaration) {
+ resourceVar = (JLocal) curMethod.locals.get(((LocalDeclaration) resource).binding);
+ } else {
+ // JLS 14.20.3.1 - Java 9 extension to try-with-resources
+ // try (expr) {}
+ // which is equivalent to
+ // try (T $resource = expr) {}
+ SourceInfo sourceInfo = resourceStatement.getSourceInfo();
+ JExpression expression = ((JExpressionStatement) resourceStatement).getExpr();
+ resourceVar = createLocal(
+ sourceInfo, "$resource", expression.getType());
+ resourceStatement =
+ new JBinaryOperation(
+ sourceInfo,
+ expression.getType(),
+ JBinaryOperator.ASG,
+ resourceVar.createRef(sourceInfo),
+ expression).makeStatement();
+ }
- JLocal resourceVar = (JLocal) curMethod.locals.get(x.resources[i].binding);
resourceVariables.add(0, resourceVar);
- tryBlock.addStmt(0, resourceDecl);
+ tryBlock.addStmt(0, resourceStatement);
}
// add exception variable
@@ -2273,9 +2294,13 @@
}
private JLocal createLocalThrowable(SourceInfo info, String prefix) {
+ return createLocal(info, prefix, javaLangThrowable);
+ }
+
+ private JLocal createLocal(SourceInfo info, String prefix, JType type) {
int index = curMethod.body.getLocals().size() + 1;
return JProgram.createLocal(info, prefix + "_" + index,
- javaLangThrowable, false, curMethod.body);
+ type, false, curMethod.body);
}
private JStatement createCloseBlockFor(
@@ -3624,37 +3649,29 @@
}
}
- private JReferenceType[] processIntersectionCastType(IntersectionTypeBinding18 type) {
- JReferenceType[] castTypes = new JReferenceType[type.intersectingTypes.length];
+ private JReferenceType[] processIntersectionType(IntersectionTypeBinding18 type) {
+ return processIntersectionType(type, new JReferenceType[type.intersectingTypes.length]);
+ }
+
+ private <T extends JReferenceType> T[] processIntersectionType(
+ IntersectionTypeBinding18 type, T[] intersectionTypes) {
int i = 0;
for (ReferenceBinding intersectingTypeBinding : type.intersectingTypes) {
JType intersectingType = typeMap.get(intersectingTypeBinding);
assert (intersectingType instanceof JReferenceType);
- castTypes[i++] = ((JReferenceType) intersectingType);
+ intersectionTypes[i++] = (T) intersectingType;
}
- return castTypes;
+ return intersectionTypes;
}
private JType[] processCastType(TypeBinding type) {
if (type instanceof IntersectionTypeBinding18) {
- return processIntersectionCastType((IntersectionTypeBinding18) type);
+ return processIntersectionType((IntersectionTypeBinding18) type);
} else {
return new JType[] {typeMap.get(type)};
}
}
- private JInterfaceType[] processIntersectionTypeForLambda(IntersectionTypeBinding18 type,
- BlockScope scope, String samSignature) {
- List<JInterfaceType> interfaces = Lists.newArrayList();
- for (ReferenceBinding intersectingTypeBinding : type.intersectingTypes) {
- if (shouldImplements(intersectingTypeBinding, scope, samSignature)) {
- JType intersectingType = typeMap.get(intersectingTypeBinding);
- assert (intersectingType instanceof JInterfaceType);
- interfaces.add(((JInterfaceType) intersectingType));
- }
- }
- return Iterables.toArray(interfaces, JInterfaceType.class);
- }
private boolean isFunctionalInterfaceWithMethod(ReferenceBinding referenceBinding, Scope scope,
String samSignature) {
@@ -3723,9 +3740,9 @@
}
}
- private <T extends JType> Iterable<T> mapTypes(TypeBinding[] types) {
+ private <T extends JType, B extends TypeBinding> Iterable<T> mapTypes(B[] types) {
return FluentIterable.from(Arrays.asList(types)).transform(
- new Function<TypeBinding, T>() {
+ new Function<B, T>() {
@Override
public T apply(TypeBinding typeBinding) {
return (T) typeMap.get(typeBinding.erasure());
@@ -4347,7 +4364,8 @@
JDeclaredType type;
if (binding.isClass()) {
- type = new JClassType(info, name, binding.isAbstract(), binding.isFinal());
+ type = new JClassType(
+ info, name, binding.isAbstract(), binding.isFinal() || binding.isAnonymousType());
} else if (binding.isInterface() || binding.isAnnotationType()) {
type = new JInterfaceType(info, name);
} else if (binding.isEnum()) {
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/SourceLevel.java b/dev/core/src/com/google/gwt/dev/util/arg/SourceLevel.java
index 89c6e0e..529cab6 100644
--- a/dev/core/src/com/google/gwt/dev/util/arg/SourceLevel.java
+++ b/dev/core/src/com/google/gwt/dev/util/arg/SourceLevel.java
@@ -23,7 +23,8 @@
*/
public enum SourceLevel {
// Source levels must appear in ascending order for the default setting logic to work.
- JAVA8("1.8", "8");
+ JAVA8("1.8", "8"),
+ JAVA9("1.9", "9");
/**
* The default java sourceLevel.
@@ -75,7 +76,6 @@
}
private static SourceLevel getJvmBestMatchingSourceLevel() {
- // If everything fails set default to JAVA8.
String javaSpecLevel = System.getProperty("java.specification.version");
return getBestMatchingVersion(javaSpecLevel);
}
diff --git a/dev/core/test/com/google/gwt/dev/CompilerTest.java b/dev/core/test/com/google/gwt/dev/CompilerTest.java
index 99a0b94..8c974d6 100644
--- a/dev/core/test/com/google/gwt/dev/CompilerTest.java
+++ b/dev/core/test/com/google/gwt/dev/CompilerTest.java
@@ -957,7 +957,7 @@
assertEquals(SourceLevel.JAVA8, SourceLevel.getBestMatchingVersion("1.7"));
assertEquals(SourceLevel.JAVA8, SourceLevel.getBestMatchingVersion("1.8"));
- assertEquals(SourceLevel.JAVA8, SourceLevel.getBestMatchingVersion("1.9"));
+ assertEquals(SourceLevel.JAVA9, SourceLevel.getBestMatchingVersion("1.9"));
// not proper version strings => default to JAVA8.
assertEquals(SourceLevel.JAVA8, SourceLevel.getBestMatchingVersion("1.6u3"));
@@ -1696,7 +1696,7 @@
File applicationDir = Files.createTempDir();
CompilerOptions compilerOptions = new CompilerOptionsImpl();
compilerOptions.setUseDetailedTypeIds(true);
- compilerOptions.setSourceLevel(SourceLevel.JAVA8);
+ compilerOptions.setSourceLevel(SourceLevel.JAVA9);
// Compile the application with no errors.
compileToJs(TreeLogger.NULL, compilerOptions, applicationDir, "com.foo.Errors",
@@ -1759,7 +1759,7 @@
File applicationDir = Files.createTempDir();
CompilerOptions compilerOptions = new CompilerOptionsImpl();
compilerOptions.setUseDetailedTypeIds(true);
- compilerOptions.setSourceLevel(SourceLevel.JAVA8);
+ compilerOptions.setSourceLevel(SourceLevel.JAVA9);
compilerOptions.setGenerateJsInteropExports(false);
// Compile the application with no errors.
@@ -2110,7 +2110,7 @@
CompilerOptions compilerOptions = new CompilerOptionsImpl();
compilerOptions.setUseDetailedTypeIds(true);
- compilerOptions.setSourceLevel(SourceLevel.JAVA8);
+ compilerOptions.setSourceLevel(SourceLevel.JAVA9);
checkRecompiledModifiedApp(compilerOptions, "com.foo.DefaultMethod",
Lists.newArrayList(moduleResource, entryPointResource, aSubclass,
diff --git a/dev/core/test/com/google/gwt/dev/javac/BinaryTypeReferenceRestrictionsCheckerTest.java b/dev/core/test/com/google/gwt/dev/javac/BinaryTypeReferenceRestrictionsCheckerTest.java
index c29caca..a5feaf6 100644
--- a/dev/core/test/com/google/gwt/dev/javac/BinaryTypeReferenceRestrictionsCheckerTest.java
+++ b/dev/core/test/com/google/gwt/dev/javac/BinaryTypeReferenceRestrictionsCheckerTest.java
@@ -40,6 +40,7 @@
import org.eclipse.jdt.internal.compiler.env.ITypeAnnotationWalker;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding;
+import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.ExternalAnnotationStatus;
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
@@ -87,6 +88,11 @@
}
@Override
+ public char[] getModule() {
+ return null;
+ }
+
+ @Override
public char[] getFileName() {
return (qualifiedTypeName.replace('.', File.separatorChar) + ".java").toCharArray();
}
@@ -171,6 +177,10 @@
ITypeAnnotationWalker walker, Object member, LookupEnvironment environment) {
return walker;
}
+ @Override
+ public ExternalAnnotationStatus getExternalAnnotationStatus() {
+ return null;
+ }
}
private static final String BINARY_TYPE_NAME = "BinaryType";
diff --git a/dev/core/test/com/google/gwt/dev/javac/Java7JdtCompilerTest.java b/dev/core/test/com/google/gwt/dev/javac/Java7JdtCompilerTest.java
index 557ea8b..6794c33 100644
--- a/dev/core/test/com/google/gwt/dev/javac/Java7JdtCompilerTest.java
+++ b/dev/core/test/com/google/gwt/dev/javac/Java7JdtCompilerTest.java
@@ -50,7 +50,7 @@
@Override
protected SourceLevel getSourceLevel() {
- // Always compile this tests as Java 8.
- return SourceLevel.JAVA8;
+ // Always compile this tests as Java 9.
+ return SourceLevel.JAVA9;
}
}
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/GwtAstBuilderTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/GwtAstBuilderTest.java
index cbf53f1..2e0c624 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/GwtAstBuilderTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/GwtAstBuilderTest.java
@@ -183,7 +183,7 @@
}
public void testNestedClassDisposition() throws UnableToCompleteException {
- sourceLevel = SourceLevel.JAVA8;
+ sourceLevel = SourceLevel.JAVA9;
sources.add(JavaResourceBase.createMockJavaResource("test.NestedClasses",
"package test;",
@@ -237,7 +237,7 @@
}
public void testIntersectionBound() throws UnableToCompleteException {
- sourceLevel = SourceLevel.JAVA8;
+ sourceLevel = SourceLevel.JAVA9;
sources.add(JavaResourceBase.createMockJavaResource("test.IntersectionBound",
"package test;",
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/Java7AstTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/Java7AstTest.java
index 98fcfd2..30c42be 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/Java7AstTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/Java7AstTest.java
@@ -30,7 +30,7 @@
// of nodes.
@Override
public void setUp() {
- sourceLevel = SourceLevel.JAVA8;
+ sourceLevel = SourceLevel.JAVA9;
addAll(JavaResourceBase.AUTOCLOSEABLE, Java7MockResources.TEST_RESOURCE,
Java7MockResources.EXCEPTION1, Java7MockResources.EXCEPTION2);
}
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/Java8AstTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/Java8AstTest.java
index 81971db..f8b40b4 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/Java8AstTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/Java8AstTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Google Inc.
+ * 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
@@ -37,7 +37,7 @@
@Override
public void setUp() throws Exception {
- sourceLevel = SourceLevel.JAVA8;
+ sourceLevel = SourceLevel.JAVA9;
super.setUp();
addAll(LAMBDA_METAFACTORY);
@@ -1092,29 +1092,6 @@
formatSource(samMethod.toSource()));
}
- public void testIntersectionCastOfLambdaWithClassType() throws Exception {
- addSnippetClassDecl("interface I1 { public void foo(); }");
- addSnippetClassDecl("class A { }");
- String lambda = "Object o = (A & I1) () -> {};";
- assertEqualBlock("Object o=(EntryPoint$A)(EntryPoint$I1)new EntryPoint$lambda$0$Type();",
- lambda);
-
- JProgram program = compileSnippet("void", lambda, false);
-
- assertNotNull(getMethod(program, "lambda$0"));
-
- JClassType lambdaInnerClass = (JClassType) getType(program, "test.EntryPoint$lambda$0$Type");
- assertNotNull(lambdaInnerClass);
- assertEquals("java.lang.Object", lambdaInnerClass.getSuperClass().getName());
- assertEquals(1, lambdaInnerClass.getImplements().size());
- assertTrue(
- lambdaInnerClass.getImplements().contains(program.getFromTypeMap("test.EntryPoint$I1")));
- // should implement foo method
- JMethod samMethod = findMethod(lambdaInnerClass, "foo");
- assertEquals("public final void foo(){EntryPoint.lambda$0();}",
- formatSource(samMethod.toSource()));
- }
-
public void testIntersectionCastOfLambdaOneAbstractMethod() throws Exception {
addSnippetClassDecl("interface I1 { public void foo(); }");
addSnippetClassDecl("interface I2 extends I1{ public void foo();}");
@@ -1141,7 +1118,7 @@
public void testIntersectionCastMultipleAbstractMethods() throws Exception {
addSnippetClassDecl("interface I1 { public void foo(); }");
- addSnippetClassDecl("interface I2 { public void bar(); public void fun();}");
+ addSnippetClassDecl("interface I2 { public void foo(); }");
String lambda = "Object o = (I1 & I2) () -> {};";
assertEqualBlock("Object o=(EntryPoint$I1)(EntryPoint$I2)new EntryPoint$lambda$0$Type();",
lambda);
@@ -1153,7 +1130,7 @@
JClassType lambdaInnerClass = (JClassType) getType(program, "test.EntryPoint$lambda$0$Type");
assertNotNull(lambdaInnerClass);
assertEquals("java.lang.Object", lambdaInnerClass.getSuperClass().getName());
- assertEquals(1, lambdaInnerClass.getImplements().size());
+ assertEquals(2, lambdaInnerClass.getImplements().size());
assertTrue(
lambdaInnerClass.getImplements().contains(program.getFromTypeMap("test.EntryPoint$I1")));
// should implement foo method
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/Java9AstTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/Java9AstTest.java
new file mode 100644
index 0000000..9856840
--- /dev/null
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/Java9AstTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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 com.google.gwt.dev.jjs.impl;
+
+import com.google.gwt.dev.javac.testing.impl.JavaResourceBase;
+import com.google.gwt.dev.jjs.ast.JInterfaceType;
+import com.google.gwt.dev.jjs.ast.JMethod;
+import com.google.gwt.dev.jjs.ast.JMethodBody;
+import com.google.gwt.dev.jjs.ast.JProgram;
+import com.google.gwt.dev.util.arg.SourceLevel;
+
+/**
+ * Tests that {@link com.google.gwt.dev.jjs.impl.GwtAstBuilder} correctly builds the AST for
+ * features introduced in Java 9.
+ */
+public class Java9AstTest extends FullCompileTestBase {
+
+ @Override
+ public void setUp() throws Exception {
+ sourceLevel = SourceLevel.JAVA9;
+ super.setUp();
+ addAll(
+ JavaResourceBase.createMockJavaResource("test.InterfaceWithPrivateMethods",
+ "package test;",
+ "public interface InterfaceWithPrivateMethods {",
+ " default int defaultMethod() { return privateMethod(); }",
+ " private int privateMethod() { return 42; }",
+ " private static int staticPrivateMethod() { return 42; }",
+ "}"),
+ JavaResourceBase.createMockJavaResource("test.TestResource",
+ "package test;",
+ "public class TestResource implements AutoCloseable {",
+ " public void close() { }",
+ "}"));
+ }
+
+ public void testCompileTryWithResources() throws Exception {
+ assertEqualBlock(
+ "TestResource r = new TestResource();"
+ + "try {"
+ + " Throwable $primary_ex_3 = null;"
+ + " try {"
+ + " $resource_2 = r;"
+ + " } catch(Throwable $caught_ex_4) {"
+ + " $primary_ex_3 = $caught_ex_4;"
+ + " throw $primary_ex_3;"
+ + " } finally {"
+ + " $primary_ex_3 = Exceptions.safeClose($resource_2,$primary_ex_3);"
+ + " if ($primary_ex_3 != null)"
+ + " throw $primary_ex_3;"
+ + " }"
+ + "}",
+ "TestResource r = new TestResource();"
+ + "try (r) {}");
+ }
+
+ public void testInterfaceWithPrivateMethods() throws Exception {
+ JProgram program =
+ compileSnippet("void",
+ "(new InterfaceWithPrivateMethods() {}).defaultMethod();", false);
+
+ JInterfaceType interfaceWithPrivateMethods =
+ (JInterfaceType) getType(program, "test.InterfaceWithPrivateMethods");
+ // should have an actual method with body on it
+ JMethod defaultMethod = findMethod(interfaceWithPrivateMethods, "defaultMethod");
+ assertEquals(1, ((JMethodBody) defaultMethod.getBody()).getBlock().getStatements().size());
+ JMethod privateMethod = findMethod(interfaceWithPrivateMethods, "privateMethod");
+ assertEquals(1, ((JMethodBody) privateMethod.getBody()).getBlock().getStatements().size());
+ JMethod staticPrivateMethod = findMethod(interfaceWithPrivateMethods, "staticPrivateMethod");
+ assertEquals(1,
+ ((JMethodBody) staticPrivateMethod.getBody()).getBlock().getStatements().size());
+ }
+
+ @Override
+ protected void optimizeJava() {
+ }
+}
\ No newline at end of file
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java
index a928f10..5db3102 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java
@@ -28,7 +28,7 @@
public class JsInteropRestrictionCheckerTest extends OptimizerTestBase {
@Override
public void setUp() {
- sourceLevel = SourceLevel.JAVA8;
+ sourceLevel = SourceLevel.JAVA9;
}
// TODO: eventually test this for default methods in Java 8.
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/PrunerTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/PrunerTest.java
index 5af563f..d4c61ff 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/PrunerTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/PrunerTest.java
@@ -27,7 +27,7 @@
public class PrunerTest extends OptimizerTestBase {
@Override
protected void setUp() throws Exception {
- sourceLevel = SourceLevel.JAVA8;
+ sourceLevel = SourceLevel.JAVA9;
super.setUp();
runDeadCodeElimination = true;
}
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/UnifyAstTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/UnifyAstTest.java
index 9938f40..48f324d 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/UnifyAstTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/UnifyAstTest.java
@@ -33,7 +33,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- sourceLevel = SourceLevel.JAVA8;
+ sourceLevel = SourceLevel.JAVA9;
}
public void testPackageInfo_defaultPackagePresent() throws Exception {
diff --git a/eclipse/dev/.classpath b/eclipse/dev/.classpath
index 261aa18..bd0db28 100644
--- a/eclipse/dev/.classpath
+++ b/eclipse/dev/.classpath
@@ -6,8 +6,8 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/apache/ant-1.6.5.jar" sourcepath="/GWT_TOOLS/lib/apache/ant-1.6.5-src.zip"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/apache/tapestry-util-text-4.0.2.jar" sourcepath="/GWT_TOOLS/lib/apache/tapestry-util-text-4.0.2-src.zip"/>
- <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.11.2-CUSTOM-GWT-2.8-20160205.jar" sourcepath="/GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core.source_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
- <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
+ <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.13.50.v20171007-0855.jar" sourcepath="/GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core.source_3.13.50.v20171007-0855.jar"/>
+ <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.13.50.v20171007-0855.jar"/>
<classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/jetty/jetty-9.2.14.v20151106/jetty-all-9.2.14.v20151106.jar"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/jsr305/jsr305.jar"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/junit/junit-4.8.2.jar" sourcepath="/GWT_TOOLS/lib/junit/junit-4.8.2-src.zip"/>
diff --git a/eclipse/dev/compiler/.classpath b/eclipse/dev/compiler/.classpath
index 356cf0c..83c10fc 100644
--- a/eclipse/dev/compiler/.classpath
+++ b/eclipse/dev/compiler/.classpath
@@ -4,8 +4,8 @@
<classpathentry excluding="com/google/gwt/dev/jjs/intrinsic/" kind="src" path="core/super"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/apache/ant-1.6.5.jar" sourcepath="/GWT_TOOLS/lib/apache/ant-1.6.5-src.zip"/>
- <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.11.2-CUSTOM-GWT-2.8-20160205.jar" sourcepath="/GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core.source_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
- <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
+ <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.13.50.v20171007-0855.jar" sourcepath="/GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core.source_3.13.50.v20171007-0855.jar"/>
+ <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.13.50.v20171007-0855.jar"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/junit/junit-4.8.2.jar" sourcepath="/GWT_TOOLS/lib/junit/junit-4.8.2-src.zip"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/apache/commons/commons-collections-3.2.2.jar"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/guava/guava-16.0.1/guava-16.0.1-rebased.jar"/>
diff --git a/eclipse/settings/code-style/gwt-checkstyle-suppressions.xml b/eclipse/settings/code-style/gwt-checkstyle-suppressions.xml
new file mode 100644
index 0000000..28cce46
--- /dev/null
+++ b/eclipse/settings/code-style/gwt-checkstyle-suppressions.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!DOCTYPE suppressions PUBLIC
+ "-//Puppy Crawl//DTD Suppressions 1.0//EN"
+ "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
+<suppressions>
+ <suppress checks="TreeWalker"
+ files="user/test-super/com/google/gwt/dev/jjs/super/com/google/gwt/dev/jjs/test/Java8Test.java"/>
+</suppressions>
\ No newline at end of file
diff --git a/eclipse/settings/code-style/gwt-checkstyle-tests.xml b/eclipse/settings/code-style/gwt-checkstyle-tests.xml
index ae1f9b7..b487425 100644
--- a/eclipse/settings/code-style/gwt-checkstyle-tests.xml
+++ b/eclipse/settings/code-style/gwt-checkstyle-tests.xml
@@ -247,4 +247,7 @@
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="ParameterName"/>
</module>
+ <module name="SuppressionFilter">
+ <property name="file" value="eclipse/settings/code-style/gwt-checkstyle-suppressions.xml"/>
+ </module>
</module>
diff --git a/eclipse/user/.classpath b/eclipse/user/.classpath
index f412807..630188a 100644
--- a/eclipse/user/.classpath
+++ b/eclipse/user/.classpath
@@ -62,7 +62,7 @@
<classpathentry kind="var" path="GWT_TOOLS/lib/testng/testng-5.14.1-nojunit.jar" sourcepath="/GWT_TOOLS/lib/testng/testng-5.14.1-sources.jar"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/protobuf/protobuf-2.5.0/protobuf-java-rebased-2.5.0.jar"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20160315/sourcemap-rebased.jar"/>
- <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
- <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
+ <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.13.50.v20171007-0855.jar"/>
+ <classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.13.50.v20171007-0855.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/user/test-super/com/google/gwt/dev/jjs/super/com/google/gwt/dev/jjs/test/Java8Test.java b/user/test-super/com/google/gwt/dev/jjs/super/com/google/gwt/dev/jjs/test/Java8Test.java
index e084910..d46bbdb 100644
--- a/user/test-super/com/google/gwt/dev/jjs/super/com/google/gwt/dev/jjs/test/Java8Test.java
+++ b/user/test-super/com/google/gwt/dev/jjs/super/com/google/gwt/dev/jjs/test/Java8Test.java
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.IntFunction;
+import java.util.function.Supplier;
import java.util.stream.Collectors;
import jsinterop.annotations.JsFunction;
@@ -720,43 +721,15 @@
interface SimpleI {
int fun();
}
- interface SimpleJ {
- int foo();
- int bar();
- }
interface SimpleK {
}
public void testIntersectionCastWithLambdaExpr() {
- SimpleI simpleI1 = (SimpleI & EmptyI) () -> { return 11; };
+ SimpleI simpleI1 = (SimpleI & EmptyI) () -> 11;
assertEquals(11, simpleI1.fun());
- SimpleI simpleI2 = (EmptyI & SimpleI) () -> { return 22; };
+ SimpleI simpleI2 = (EmptyI & SimpleI) () -> 22;
assertEquals(22, simpleI2.fun());
- EmptyI emptyI = (EmptyI & SimpleI) () -> { return 33; };
- try {
- ((EmptyA & SimpleI) () -> { return 33; }).fun();
- fail("Should have thrown a ClassCastException");
- } catch (ClassCastException e) {
- // expected.
- }
- try {
- ((SimpleI & SimpleJ) () -> { return 44; }).fun();
- fail("Should have thrown a ClassCastException");
- } catch (ClassCastException e) {
- // expected.
- }
- try {
- ((SimpleI & SimpleJ) () -> { return 44; }).foo();
- fail("Should have thrown a ClassCastException");
- } catch (ClassCastException e) {
- // expected.
- }
- try {
- ((SimpleI & SimpleJ) () -> { return 44; }).bar();
- fail("Should have thrown a ClassCastException");
- } catch (ClassCastException e) {
- // expected.
- }
- assertEquals(55, ((SimpleI & SimpleK) () -> { return 55; }).fun());
+ EmptyI emptyI = (EmptyI & SimpleI) () -> 33;
+ assertEquals(55, ((SimpleI & SimpleK) () -> 55).fun());
}
class SimpleA {
@@ -2007,4 +1980,62 @@
assertEquals(2, (int) unboxBox.apply(2));
assertEquals(2, (int) unboxBox.apply(new Integer(2)));
}
+
+ ////////////////////////////////////////////////////////////
+ //
+ // Tests for language features introduced in Java 9
+
+ class Resource implements AutoCloseable {
+ boolean isOpen = true;
+
+ public void close() {
+ this.isOpen = false;
+ }
+ }
+
+ public void testTryWithResourcesJava9() {
+ Resource r1 = new Resource();
+ assertTrue(r1.isOpen);
+ Resource r2Copy;
+ try (r1; Resource r2 = new Resource()) {
+ assertTrue(r1.isOpen);
+ assertTrue(r2.isOpen);
+ r2Copy = r2;
+ }
+ assertFalse(r1.isOpen);
+ assertFalse(r2Copy.isOpen);
+ }
+
+ private interface InterfaceWithPrivateMethods {
+ int implementedMethod();
+
+ default int defaultMethod() {
+ return privateMethod();
+ }
+
+ private int privateMethod() {
+ return implementedMethod();
+ }
+
+ private int staticPrivateMethod() {
+ return 42;
+ }
+ }
+
+ public void testInterfacePrivateMethodsJava9() {
+ InterfaceWithPrivateMethods implementor = () -> 50;
+ assertEquals(50, implementor.implementedMethod());
+ assertEquals(50, implementor.defaultMethod());
+ assertEquals(42, implementor.staticPrivateMethod());
+ }
+
+ public void testAnonymousDiamondJava9() {
+ Supplier<String> helloSupplier = new Supplier<>() {
+ @Override
+ public String get() {
+ return "hello";
+ }
+ };
+ assertEquals("hello", helloSupplier.get());
+ }
}
diff --git a/user/test/com/google/gwt/dev/jjs/test/Java8Test.java b/user/test/com/google/gwt/dev/jjs/test/Java8Test.java
index b63929b..e706f45 100644
--- a/user/test/com/google/gwt/dev/jjs/test/Java8Test.java
+++ b/user/test/com/google/gwt/dev/jjs/test/Java8Test.java
@@ -36,8 +36,8 @@
@Override
public void runTest() throws Throwable {
- // Only run these tests if -sourceLevel 8 (or greater) is enabled.
- if (isGwtSourceLevel8()) {
+ // Only run these tests if -sourceLevel 9 (or greater) is enabled.
+ if (isGwtSourceLevel9()) {
super.runTest();
}
}
@@ -45,302 +45,314 @@
public void testLambdaNoCapture() {
// Make sure we are using the right Java8Test if the source compatibility level is set to Java 8
// or above.
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaCaptureLocal() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaCaptureLocalWithInnerClass() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaCaptureLocalAndField() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaCaptureLocalAndFieldWithInnerClass() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testCompileLambdaCaptureOuterInnerField() throws Exception {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testStaticReferenceBinding() throws Exception {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testInstanceReferenceBinding() throws Exception {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testImplicitQualifierReferenceBinding() throws Exception {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testConstructorReferenceBinding() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testStaticInterfaceMethod() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testArrayConstructorReference() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testArrayConstructorReferenceBoxed() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testVarArgsReferenceBinding() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testVarArgsPassthroughReferenceBinding() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testVarArgsPassthroughReferenceBindingProvidedArray() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testSuperReferenceExpression() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testSuperReferenceExpressionWithVarArgs() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testPrivateConstructorReference() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testDefaultInterfaceMethod() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testDefaultInterfaceMethodVirtualUpRef() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testInterfaceWithDefaultMethodsInitialization() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testDefaultInterfaceMethodMultiple() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testDefaultMethodReference() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testDefenderMethodByInterfaceInstance() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testDefaultMethod_staticInitializer() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testThisRefInDefenderMethod() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testClassImplementsTwoInterfacesWithSameDefenderMethod() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testAbstractClassImplementsInterface() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testSuperRefInDefenderMethod() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testSuperThisRefsInDefenderMethod() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testNestedInterfaceClass() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testBaseIntersectionCast() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testIntersectionCastWithLambdaExpr() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testIntersectionCastPolymorphism() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaCaptureParameter() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaNestingCaptureLocal() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaNestingInAnonymousCaptureLocal() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaNestingInMultipleMixedAnonymousCaptureLocal() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaNestingInMultipleMixedAnonymousCaptureLocal_withInterference() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaNestingInMultipleMixedAnonymousCaptureLocalAndField() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaNestingInMultipleAnonymousCaptureLocal() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaNestingCaptureField_InnerClassCapturingOuterClassVariable() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testInnerClassCaptureLocalFromOuterLambda() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaNestingCaptureField() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaMultipleNestingCaptureFieldAndLocal() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaMultipleNestingCaptureFieldAndLocalInnerClass() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMethodRefWithSameName() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMultipleDefaults_fromInterfaces_left() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMultipleDefaults_fromInterfaces_right() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMultipleDefaults_superclass_left() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMultipleDefaults_superclass_right() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMultipleDefaults_defaultShadowsOverSyntheticAbstractStub() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMultipleDefaults_defaultShadowsOverDefaultOnSuperAbstract() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testInterfaceThis() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMethodReference_generics() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testNativeJsTypeWithStaticInitializer() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testJsVarargsLambda() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMethodReference_implementedInSuperclass() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMethodReference_genericTypeParameters() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMethodReference_autoboxing() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testMethodReference_varargs() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testNativeJsOverlay_lambda() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaCapturingThis_onDefaultMethod() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testJsFunction_withOverlay() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testFunctionalExpressionBridges() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testCorrectNaming() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testInterfaceWithOverlayAndNativeSubclass() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLocalClassConstructorReferenceInStaticMethod() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testDefaultMethodDevirtualizationOrder() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testVarargsFunctionalConversion() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testJSOLivenessSingleImplErasure() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaErasureCasts() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
public void testLambdaBoxing() {
- assertFalse(isGwtSourceLevel8());
+ assertFalse(isGwtSourceLevel9());
}
- private boolean isGwtSourceLevel8() {
- return JUnitShell.getCompilerOptions().getSourceLevel().compareTo(SourceLevel.JAVA8) >= 0;
+ public void testTryWithResourcesJava9() {
+ assertFalse(isGwtSourceLevel9());
+ }
+
+ public void testInterfacePrivateMethodsJava9() {
+ assertFalse(isGwtSourceLevel9());
+ }
+
+ public void testAnonymousDiamondJava9() {
+ assertFalse(isGwtSourceLevel9());
+ }
+
+ private boolean isGwtSourceLevel9() {
+ return JUnitShell.getCompilerOptions().getSourceLevel().compareTo(SourceLevel.JAVA9) >= 0;
}
}