Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Arthanareeswaran2018-03-14 06:10:07 -0400
committerJay Arthanareeswaran2018-03-14 07:34:23 -0400
commit9d60ece456a50537166460b9f7f4ecdad37d72e5 (patch)
tree4840ee5a9c0e75cf4c3f51165981d5e43aa64eaf /org.eclipse.jdt.compiler.apt.tests
parentf55d69502d5f7bd50a6bad98a6e170aeddab8ae6 (diff)
downloadeclipse.jdt.core-9d60ece456a50537166460b9f7f4ecdad37d72e5.tar.gz
eclipse.jdt.core-9d60ece456a50537166460b9f7f4ecdad37d72e5.tar.xz
eclipse.jdt.core-9d60ece456a50537166460b9f7f4ecdad37d72e5.zip
Bug 530444 - [10] JSR 269 API changesY20180315-1000
Include the API from java.compiler module (as a plain old JAR) to the relevant projects. Change-Id: If2fe8656c50a286d38adb8c4d91eda4fbaee5261 Signed-off-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
Diffstat (limited to 'org.eclipse.jdt.compiler.apt.tests')
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/.classpath2
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/build.properties4
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/java10/java10api.jarbin0 -> 109915 bytes
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/java9/java9api.jarbin25089 -> 0 bytes
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jarbin233186 -> 235044 bytes
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/inherited/ArgsConstructorProcessor.java1
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/visitors/VisitorProc.java4
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java9ElementProcessor.java18
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/util/TestDirectiveVisitor.java32
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java9ElementsTests.java7
11 files changed, 62 insertions, 8 deletions
diff --git a/org.eclipse.jdt.compiler.apt.tests/.classpath b/org.eclipse.jdt.compiler.apt.tests/.classpath
index 2dc14fa091..df856ce433 100644
--- a/org.eclipse.jdt.compiler.apt.tests/.classpath
+++ b/org.eclipse.jdt.compiler.apt.tests/.classpath
@@ -4,7 +4,7 @@
<classpathentry kind="src" output="binprocessors" path="processors"/>
<classpathentry kind="src" output="binprocessors8" path="processors8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="lib" path="java9/java9api.jar"/>
+ <classpathentry kind="lib" path="java10/java10api.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF b/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
index aadda7bbfb..79a2d79b6f 100644
--- a/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
@@ -19,6 +19,6 @@ Export-Package: org.eclipse.jdt.compiler.apt.tests,
org.eclipse.jdt.compiler.apt.tests.processors.visitors
Import-Package: org.eclipse.jdt.internal.compiler.tool;resolution:=optional
Eclipse-BundleShape: dir
-Bundle-ClassPath: java9/java9api.jar,
+Bundle-ClassPath: java10/java10api.jar,
.
Automatic-Module-Name: org.eclipse.jdt.compiler.apt.tests
diff --git a/org.eclipse.jdt.compiler.apt.tests/build.properties b/org.eclipse.jdt.compiler.apt.tests/build.properties
index 7df12f4db2..85f0f21d3f 100644
--- a/org.eclipse.jdt.compiler.apt.tests/build.properties
+++ b/org.eclipse.jdt.compiler.apt.tests/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2006, 2017 BEA Systems Inc. and others
+# Copyright (c) 2006, 2018 BEA Systems Inc. and others
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -25,4 +25,4 @@ bin.includes = about.html,\
.
src.includes = about.html
compilerArg=-proc:none
-jars.extra.classpath = java9/java9api.jar
+jars.extra.classpath = java10/java10api.jar
diff --git a/org.eclipse.jdt.compiler.apt.tests/java10/java10api.jar b/org.eclipse.jdt.compiler.apt.tests/java10/java10api.jar
new file mode 100644
index 0000000000..464b69134f
--- /dev/null
+++ b/org.eclipse.jdt.compiler.apt.tests/java10/java10api.jar
Binary files differ
diff --git a/org.eclipse.jdt.compiler.apt.tests/java9/java9api.jar b/org.eclipse.jdt.compiler.apt.tests/java9/java9api.jar
deleted file mode 100644
index fd56ad100e..0000000000
--- a/org.eclipse.jdt.compiler.apt.tests/java9/java9api.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar
index 1e01a671f2..3686d6500f 100644
--- a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar
+++ b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar
Binary files differ
diff --git a/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/inherited/ArgsConstructorProcessor.java b/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/inherited/ArgsConstructorProcessor.java
index b8aa884386..4eabf11976 100644
--- a/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/inherited/ArgsConstructorProcessor.java
+++ b/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/inherited/ArgsConstructorProcessor.java
@@ -160,6 +160,7 @@ public class ArgsConstructorProcessor extends BaseProcessor {
return false;
}
+ @SuppressWarnings("deprecation")
private final TypeVisitor<Boolean, List<TypeMirror>> argsVisitor = new SimpleTypeVisitor6<Boolean, List<TypeMirror>>() {
@Override
public Boolean visitExecutable(ExecutableType t,
diff --git a/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/visitors/VisitorProc.java b/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/visitors/VisitorProc.java
index fb387cacb2..591e3c80a6 100644
--- a/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/visitors/VisitorProc.java
+++ b/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/visitors/VisitorProc.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 BEA Systems, Inc.
+ * Copyright (c) 2007, 2018 BEA Systems, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -47,6 +47,7 @@ public class VisitorProc extends BaseProcessor
* This visitor is invoked on the top-level types in resources/targets/model.
* We expect to see each of the visitX() methods get hit as a result.
*/
+ @SuppressWarnings("deprecation")
private static class ElementVisitorTester extends ElementScanner6<Void, Void> {
public enum Visited { TYPE, EXECUTABLE, VARIABLE, TYPEPARAM, PACKAGE, UNKNOWN }
@@ -129,6 +130,7 @@ public class VisitorProc extends BaseProcessor
/*
* The specific values checked by this visitor correspond to values in targets.model.pc.TypedAnnos.java
*/
+ @SuppressWarnings("deprecation")
private static class AnnotationVisitorTester extends AbstractAnnotationValueVisitor6<Void, Void> {
public enum Visited { ANNOTATION, ARRAY, BOOLEAN, BYTE, CHAR, DOUBLE, ENUMCONSTANT, FLOAT, INT, LONG, SHORT, STRING, TYPE }
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 886054b020..57b4b9c3b1 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 IBM Corporation.
+ * Copyright (c) 2017, 2018 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -45,6 +45,7 @@ import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import org.eclipse.jdt.compiler.apt.tests.processors.base.BaseProcessor;
+import org.eclipse.jdt.compiler.apt.tests.processors.util.TestDirectiveVisitor;
/**
* A processor that explores the java 9 specific elements and validates the lambda and
@@ -674,6 +675,21 @@ public class Java9ElementProcessor extends BaseProcessor {
}
}
+ public void testDirectiveVisitor() {
+ ModuleElement mod = _elementUtils.getModuleElement("mod.b");
+ assertNotNull("mod.b module null", mod);
+ try {
+ TestDirectiveVisitor<Object, Object> t = new TestDirectiveVisitor<>();
+ List<? extends Directive> directives = mod.getDirectives();
+ for (Directive directive : directives) {
+ Object result = t.visit(directive);
+ assertSame("Objects should be same", result, directive);
+ }
+
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ }
+ }
private void validateModifiers(ExecutableElement method, Modifier[] expected) {
Set<Modifier> modifiers = method.getModifiers();
List<Modifier> list = new ArrayList<>(modifiers);
diff --git a/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/util/TestDirectiveVisitor.java b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/util/TestDirectiveVisitor.java
new file mode 100644
index 0000000000..82e43ee440
--- /dev/null
+++ b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/util/TestDirectiveVisitor.java
@@ -0,0 +1,32 @@
+package org.eclipse.jdt.compiler.apt.tests.processors.util;
+
+import javax.lang.model.element.ModuleElement.*;
+
+public class TestDirectiveVisitor<R, P> implements DirectiveVisitor<Object, Object> {
+
+ @Override
+ public Object visitExports(ExportsDirective arg0, Object arg1) {
+ return arg0;
+ }
+
+ @Override
+ public Object visitOpens(OpensDirective arg0, Object arg1) {
+ return arg0;
+ }
+
+ @Override
+ public Object visitProvides(ProvidesDirective arg0, Object arg1) {
+ return arg0;
+ }
+
+ @Override
+ public Object visitRequires(RequiresDirective arg0, Object arg1) {
+ return arg0;
+ }
+
+ @Override
+ public Object visitUses(UsesDirective arg0, Object arg1) {
+ return arg0;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java9ElementsTests.java b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java9ElementsTests.java
index fb57fea7b3..f677a4c95c 100644
--- a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java9ElementsTests.java
+++ b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java9ElementsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2017 IBM Corporation.
+ * Copyright (c) 2017, 2018 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -371,7 +371,10 @@ public class Java9ElementsTests extends TestCase {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
internalTestWithBinary(compiler, MODULE_PROC, "9", "testBug521723", null, "bug521723");
}
-
+ public void testDirectiveVisitorJavac() throws IOException {
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ internalTest2(compiler, MODULE_PROC, "testDirectiveVisitor", null);
+ }
protected void internalTestWithBinary(JavaCompiler compiler, String processor, String compliance, String testMethod, String testClass, String resourceArea) throws IOException {
if (!canRunJava9()) {
return;

Back to the top