Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Arthanareeswaran2018-03-16 13:12:32 -0400
committerJay Arthanareeswaran2018-03-16 13:20:30 -0400
commit0574db9360ba34dc60ca55c743cc86eb6aa06d51 (patch)
treeb028d60c7a671fd280701e9a0bff8eb4248cdc63 /org.eclipse.jdt.compiler.apt.tests
parent9112986a7338c216fa749a9e849ffb96c86cfcc4 (diff)
downloadeclipse.jdt.core-0574db9360ba34dc60ca55c743cc86eb6aa06d51.tar.gz
eclipse.jdt.core-0574db9360ba34dc60ca55c743cc86eb6aa06d51.tar.xz
eclipse.jdt.core-0574db9360ba34dc60ca55c743cc86eb6aa06d51.zip
Bug 532450 - TypesImpl doesn't yet implement certain methods
Change-Id: I2ceae7d411acfe025fcdf4868a892feabf78a14d 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/lib/apttestprocessors8.jarbin235044 -> 235795 bytes
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java9ElementProcessor.java55
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java9ElementsTests.java4
3 files changed, 59 insertions, 0 deletions
diff --git a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar
index 3686d6500f..37fe826876 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/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 57b4b9c3b1..8310874eba 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
@@ -690,6 +690,61 @@ public class Java9ElementProcessor extends BaseProcessor {
e.printStackTrace();
}
}
+ public void testTypesImpl() {
+ ModuleElement mod = _elementUtils.getModuleElement("mod.a");
+ Set<? extends TypeElement> typeElements = _elementUtils.getAllTypeElements("abc.internal.A");
+ assertNotNull("mod.b module null", mod);
+ assertNotNull("Type should not be null", typeElements);
+ assertEquals("Incorrect no of types", 1, typeElements.size());
+ TypeElement tElement = null;
+ for (TypeElement typeElement : typeElements) {
+ tElement = typeElement;
+ }
+ assertNotNull("Package should not be null", tElement);
+ TypeMirror t = tElement.asType();
+ boolean exception = false;
+ try {
+ _typeUtils.erasure(mod.asType());
+ } catch(IllegalArgumentException iae) {
+ exception = true;
+ }
+ assertTrue("Exception not thrown", exception);
+ exception = false;
+ try {
+ _typeUtils.capture(mod.asType());
+ } catch(IllegalArgumentException iae) {
+ exception = true;
+ }
+ assertTrue("Exception not thrown", exception);
+ exception = false;
+ try {
+ _typeUtils.directSupertypes(mod.asType());
+ } catch(IllegalArgumentException iae) {
+ exception = true;
+ }
+ assertTrue("Exception not thrown", exception);
+ exception = false;
+ try {
+ _typeUtils.isSubtype(mod.asType(), t);
+ } catch(IllegalArgumentException iae) {
+ exception = true;
+ }
+ assertTrue("Exception not thrown", exception);
+ exception = false;
+ try {
+ _typeUtils.isAssignable(mod.asType(), t);
+ } catch(IllegalArgumentException iae) {
+ exception = true;
+ }
+ assertTrue("Exception not thrown", exception);
+ exception = false;
+ try {
+ _typeUtils.contains(mod.asType(), t);
+ } catch(IllegalArgumentException iae) {
+ exception = true;
+ }
+ assertTrue("Exception not thrown", exception);
+ }
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/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 f677a4c95c..6a048807a7 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
@@ -375,6 +375,10 @@ public class Java9ElementsTests extends TestCase {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
internalTest2(compiler, MODULE_PROC, "testDirectiveVisitor", null);
}
+ public void testTypesImpl() throws IOException {
+ JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
+ internalTest2(compiler, MODULE_PROC, "testTypesImpl", 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