diff options
author | Jay Arthanareeswaran | 2018-03-14 10:10:07 +0000 |
---|---|---|
committer | Jay Arthanareeswaran | 2018-03-14 11:34:23 +0000 |
commit | 9d60ece456a50537166460b9f7f4ecdad37d72e5 (patch) | |
tree | 4840ee5a9c0e75cf4c3f51165981d5e43aa64eaf | |
parent | f55d69502d5f7bd50a6bad98a6e170aeddab8ae6 (diff) | |
download | eclipse.jdt.core-Y20180315-1000.tar.gz eclipse.jdt.core-Y20180315-1000.tar.xz eclipse.jdt.core-Y20180315-1000.zip |
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>
24 files changed, 78 insertions, 24 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 Binary files differnew file mode 100644 index 0000000000..464b69134f --- /dev/null +++ b/org.eclipse.jdt.compiler.apt.tests/java10/java10api.jar diff --git a/org.eclipse.jdt.compiler.apt.tests/java9/java9api.jar b/org.eclipse.jdt.compiler.apt.tests/java9/java9api.jar Binary files differdeleted file mode 100644 index fd56ad100e..0000000000 --- a/org.eclipse.jdt.compiler.apt.tests/java9/java9api.jar +++ /dev/null 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 1e01a671f2..3686d6500f 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/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; diff --git a/org.eclipse.jdt.compiler.apt/build.properties b/org.eclipse.jdt.compiler.apt/build.properties index cb4935b695..62b759607f 100644 --- a/org.eclipse.jdt.compiler.apt/build.properties +++ b/org.eclipse.jdt.compiler.apt/build.properties @@ -19,4 +19,4 @@ jars.compile.order = . output.. = bin/ source.. = src/ -jars.extra.classpath = lib/java9api.jar +jars.extra.classpath = lib/java10api.jar diff --git a/org.eclipse.jdt.compiler.apt/lib/java10api.jar b/org.eclipse.jdt.compiler.apt/lib/java10api.jar Binary files differnew file mode 100644 index 0000000000..464b69134f --- /dev/null +++ b/org.eclipse.jdt.compiler.apt/lib/java10api.jar diff --git a/org.eclipse.jdt.compiler.apt/lib/java9api.jar b/org.eclipse.jdt.compiler.apt/lib/java9api.jar Binary files differdeleted file mode 100644 index fd56ad100e..0000000000 --- a/org.eclipse.jdt.compiler.apt/lib/java9api.jar +++ /dev/null diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java index de3e371739..47209023dc 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 IBM Corporation and others. + * Copyright (c) 2017, 2018 IBM Corporation 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 @@ -221,7 +221,7 @@ public class ModuleElementImpl extends ElementImpl implements ModuleElement { @Override public <R, P> R accept(DirectiveVisitor<R, P> visitor, P param) { - return visitor.visit(this); + return visitor.visitExports(this, param); } @Override @@ -254,7 +254,7 @@ public class ModuleElementImpl extends ElementImpl implements ModuleElement { @Override public <R, P> R accept(DirectiveVisitor<R, P> visitor, P param) { - return visitor.visit(this); + return visitor.visitRequires(this, param); } @Override @@ -287,7 +287,7 @@ public class ModuleElementImpl extends ElementImpl implements ModuleElement { @Override public <R, P> R accept(DirectiveVisitor<R, P> visitor, P param) { - return visitor.visit(this); + return visitor.visitOpens(this, param); } @Override @@ -312,7 +312,7 @@ public class ModuleElementImpl extends ElementImpl implements ModuleElement { @Override public <R, P> R accept(DirectiveVisitor<R, P> visitor, P param) { - return visitor.visit(this); + return visitor.visitUses(this, param); } @Override @@ -338,7 +338,7 @@ public class ModuleElementImpl extends ElementImpl implements ModuleElement { @Override public <R, P> R accept(DirectiveVisitor<R, P> visitor, P param) { - return visitor.visit(this); + return visitor.visitProvides(this, param); } @Override diff --git a/org.eclipse.jdt.compiler.tool.tests/.classpath b/org.eclipse.jdt.compiler.tool.tests/.classpath index 2ae2e50653..a3b97caae2 100644 --- a/org.eclipse.jdt.compiler.tool.tests/.classpath +++ b/org.eclipse.jdt.compiler.tool.tests/.classpath @@ -2,7 +2,7 @@ <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="lib" path="lib/java9api.jar"/> + <classpathentry kind="lib" path="lib/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.tool.tests/build.properties b/org.eclipse.jdt.compiler.tool.tests/build.properties index 38fab73cd8..0f45a5bcdd 100644 --- a/org.eclipse.jdt.compiler.tool.tests/build.properties +++ b/org.eclipse.jdt.compiler.tool.tests/build.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2017 IBM Corporation and others. +# Copyright (c) 2000, 2018 IBM Corporation 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 @@ -13,9 +13,9 @@ bin.includes = META-INF/,\ about.html,\ plugin.properties,\ test.xml,\ - lib/java9api.jar,\ + lib/java10api.jar,\ . src.includes = about.html source.. = src/ output.. = bin/ -jars.extra.classpath = lib/java9api.jar +jars.extra.classpath = lib/java10api.jar diff --git a/org.eclipse.jdt.compiler.tool.tests/lib/java10api.jar b/org.eclipse.jdt.compiler.tool.tests/lib/java10api.jar Binary files differnew file mode 100644 index 0000000000..464b69134f --- /dev/null +++ b/org.eclipse.jdt.compiler.tool.tests/lib/java10api.jar diff --git a/org.eclipse.jdt.compiler.tool.tests/lib/java9api.jar b/org.eclipse.jdt.compiler.tool.tests/lib/java9api.jar Binary files differdeleted file mode 100644 index fd56ad100e..0000000000 --- a/org.eclipse.jdt.compiler.tool.tests/lib/java9api.jar +++ /dev/null diff --git a/org.eclipse.jdt.compiler.tool/.classpath b/org.eclipse.jdt.compiler.tool/.classpath index 2ae2e50653..a3b97caae2 100644 --- a/org.eclipse.jdt.compiler.tool/.classpath +++ b/org.eclipse.jdt.compiler.tool/.classpath @@ -2,7 +2,7 @@ <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="lib" path="lib/java9api.jar"/> + <classpathentry kind="lib" path="lib/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.tool/META-INF/MANIFEST.MF b/org.eclipse.jdt.compiler.tool/META-INF/MANIFEST.MF index 9040560f3e..dec9901de6 100644 --- a/org.eclipse.jdt.compiler.tool/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.compiler.tool/META-INF/MANIFEST.MF @@ -9,6 +9,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: META-INF.services, org.eclipse.jdt.internal.compiler.tool;x-internal:=true Fragment-Host: org.eclipse.jdt.core;bundle-version="[3.3.0,4.0.0)" -Bundle-ClassPath: lib/java9api.jar, +Bundle-ClassPath: lib/java10api.jar, . Automatic-Module-Name: org.eclipse.jdt.compiler.tool diff --git a/org.eclipse.jdt.compiler.tool/build.properties b/org.eclipse.jdt.compiler.tool/build.properties index 5158a97629..fbdbd84368 100644 --- a/org.eclipse.jdt.compiler.tool/build.properties +++ b/org.eclipse.jdt.compiler.tool/build.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2017 IBM Corporation and others. +# Copyright (c) 2000, 2018 IBM Corporation 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 @@ -15,6 +15,6 @@ bin.includes = META-INF/,\ .,\ about.html,\ compiler_tool_fragment.properties,\ - lib/java9api.jar + lib/java10api.jar src.includes = about.html -jars.extra.classpath = lib/java9api.jar
\ No newline at end of file +jars.extra.classpath = lib/java10api.jar
\ No newline at end of file diff --git a/org.eclipse.jdt.compiler.tool/lib/java10api.jar b/org.eclipse.jdt.compiler.tool/lib/java10api.jar Binary files differnew file mode 100644 index 0000000000..464b69134f --- /dev/null +++ b/org.eclipse.jdt.compiler.tool/lib/java10api.jar diff --git a/org.eclipse.jdt.compiler.tool/lib/java9api.jar b/org.eclipse.jdt.compiler.tool/lib/java9api.jar Binary files differdeleted file mode 100644 index fd56ad100e..0000000000 --- a/org.eclipse.jdt.compiler.tool/lib/java9api.jar +++ /dev/null |