diff options
5 files changed, 10 insertions, 103 deletions
diff --git a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar Binary files differindex 0814fbcb7e..0df7843e78 100644 --- a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar +++ b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar diff --git a/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java14ElementProcessor.java b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java14ElementProcessor.java index 76e3da54fe..4bc52c12d3 100644 --- a/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java14ElementProcessor.java +++ b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java14ElementProcessor.java @@ -170,7 +170,7 @@ public class Java14ElementProcessor extends BaseProcessor { List<RecordComponentElement> recordComponentsIn = ElementFilter.recordComponentsIn(enclosedElements); int size = recordComponentsIn.size(); assertEquals("incorrect no of record components", 1, size); - Element element = enclosedElements.get(0); + Element element = recordComponentsIn.get(0); assertEquals("Incorrect kind of element", ElementKind.RECORD_COMPONENT, element.getKind()); RecordComponentElement recordComponent = (RecordComponentElement) element; assertEquals("Incorrect name for record component", "comp_", recordComponent.getSimpleName().toString()); @@ -212,7 +212,7 @@ public class Java14ElementProcessor extends BaseProcessor { List<RecordComponentElement> recordComponentsIn = ElementFilter.recordComponentsIn(enclosedElements); int size = recordComponentsIn.size(); assertEquals("incorrect no of record components", 1, size); - Element element = enclosedElements.get(0); + Element element = recordComponentsIn.get(0); assertEquals("Incorrect kind of element", ElementKind.RECORD_COMPONENT, element.getKind()); RecordComponentElement recordComponent = (RecordComponentElement) element; diff --git a/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java9ElementProcessor.java b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java9ElementProcessor.java index 61e8434ebb..63c6bda31c 100644 --- a/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java9ElementProcessor.java +++ b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java9ElementProcessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2019 IBM Corporation. + * Copyright (c) 2017, 2020 IBM Corporation. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -422,7 +422,7 @@ public class Java9ElementProcessor extends BaseProcessor { assertNotNull("java.base module null", base); List<? extends Directive> directives = base.getDirectives(); List<Directive> filterDirective = filterDirective(directives, DirectiveKind.EXPORTS); - assertEquals("incorrect no of exports", this.isJre11 ? 107 : (this.isJre10 ? 102 : 108) , filterDirective.size()); + assertTrue("missing exports", filterDirective.size() > 100); ExportsDirective pack = null; for (Directive directive : filterDirective) { ModuleElement.ExportsDirective exports = (ExportsDirective) directive; diff --git a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/AllTests.java b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/AllTests.java index 413a63d6bc..d4116f48fe 100644 --- a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/AllTests.java +++ b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/AllTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2018 IBM, BEA Systems, Inc. and others + * Copyright (c) 2006, 2020 IBM, BEA Systems, Inc. and others * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -8,6 +8,10 @@ * * SPDX-License-Identifier: EPL-2.0 * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * wharley@bea.com - initial API and implementation * IBM Corporation - Java 8 support @@ -37,6 +41,7 @@ public class AllTests extends TestCase { suite.addTestSuite(Java9ElementsTests.class); suite.addTestSuite(Java11ElementsTests.class); suite.addTestSuite(Java12ElementsTests.class); + suite.addTestSuite(Java14ElementsTests.class); suite.addTestSuite(AnnotationProcessorTests.class); return suite; } diff --git a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java13ElementsTests.java b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java13ElementsTests.java deleted file mode 100644 index 78aa8b7204..0000000000 --- a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java13ElementsTests.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jdt.compiler.apt.tests; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.lang.model.SourceVersion; -import javax.tools.JavaCompiler; - -import org.eclipse.jdt.internal.compiler.tool.EclipseCompiler; - -import junit.framework.TestCase; - -public class Java13ElementsTests extends TestCase { - private static final String MODULE_PROC = "org.eclipse.jdt.compiler.apt.tests.processors.elements.Java13ElementProcessor"; - - public void testPreviewFlagTrue() throws IOException { - JavaCompiler compiler = BatchTestUtils.getEclipseCompiler(); - internalTestWithPreview(compiler, MODULE_PROC, "13", "testPreviewFlagTrue", null, "modules2", true); - } - public void testPreviewFlagFalse() throws IOException { - JavaCompiler compiler = BatchTestUtils.getEclipseCompiler(); - internalTestWithPreview(compiler, MODULE_PROC, "13", "testPreviewFlagFalse", null, "modules2", false); - } - - protected void internalTestWithPreview(JavaCompiler compiler, String processor, String compliance, - String testMethod, String testClass, String resourceArea, boolean preview) throws IOException { - if (!canRunJava13()) { - return; - } - System.clearProperty(processor); - File targetFolder = TestUtils.concatPath(BatchTestUtils.getSrcFolderName(), "mod_locations", resourceArea); - if (testClass == null || testClass.equals("")) { - BatchTestUtils.copyResources("mod_locations/" + resourceArea, targetFolder); - } else { - BatchTestUtils.copyResource("mod_locations/" + resourceArea + "/" + testClass, targetFolder); - } - - List<String> options = new ArrayList<String>(); - options.add("-A" + processor); - options.add("-A" + testMethod); - options.add("-processor"); - options.add(processor); - // Javac 1.8 doesn't (yet?) support the -1.8 option - if (compiler instanceof EclipseCompiler) { - options.add("-" + compliance); - } else { - options.add("-source"); - options.add(compliance); - } - if (preview) - options.add("--enable-preview"); - BatchTestUtils.compileInModuleMode(compiler, options, processor, targetFolder, null, true); - // If it succeeded, the processor will have set this property to "succeeded"; - // if not, it will set it to an error value. - assertEquals("succeeded", System.getProperty(processor)); - } - public boolean canRunJava13() { - try { - SourceVersion.valueOf("RELEASE_13"); - } catch(IllegalArgumentException iae) { - return false; - } - return true; - } - /* (non-Javadoc) - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - BatchTestUtils.init(); - } - - /* (non-Javadoc) - * @see junit.framework.TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - -}
\ No newline at end of file |