diff options
author | Stephan Herrmann | 2018-04-23 23:02:38 +0000 |
---|---|---|
committer | Stephan Herrmann | 2018-04-23 23:04:04 +0000 |
commit | 74d3bf3304f82a48f3c1a8d63f1abcde3c2c4533 (patch) | |
tree | 8c34cfbe207ac3ba668385949858749e312f810e /org.eclipse.jdt.core.tests.model | |
parent | 747856a76606d57cb67c300aa2c06c7104b1d436 (diff) | |
download | eclipse.jdt.core-74d3bf3304f82a48f3c1a8d63f1abcde3c2c4533.tar.gz eclipse.jdt.core-74d3bf3304f82a48f3c1a8d63f1abcde3c2c4533.tar.xz eclipse.jdt.core-74d3bf3304f82a48f3c1a8d63f1abcde3c2c4533.zip |
Change-Id: I23fb6975e9d0179f5a390a2c2d2c0ab99693f062
Diffstat (limited to 'org.eclipse.jdt.core.tests.model')
-rw-r--r-- | org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java index 2a543d1d3e..067e67f514 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java @@ -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 @@ -3014,4 +3014,63 @@ public void testBug507954_0001() throws JavaModelException, CoreException { } } +public void testBug533949() throws CoreException { + if (!isJRE9) return; + IJavaProject javaProject1 = null; + IJavaProject javaProject2 = null; + try { + javaProject1 = createJava9Project("mod1"); + String packA = "/mod1/src/a/"; + createFolder(packA); + createFile(packA + "A.java", + "package a;\n" + + "public abstract class A {\n"+ + "}\n"); + createFile("/mod1/src/module-info.java", + "module mod1 {\n" + + " exports a;\n"+ + "}\n"); + + javaProject2 = createJava9Project("mod2"); + addClasspathEntry(javaProject2, JavaCore.newProjectEntry(javaProject1.getPath())); + String packB = "/mod2/src/b/"; + createFolder(packB); + createFile(packB + "B.java", + "package b;\n" + + "public class B extends a.A {\n"+ + "}\n"); + createFile("/mod2/src/module-info.java", + "module mod2 {\n" + + " requires mod1;\n"+ + "}\n"); + + waitUntilIndexesReady(); + + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy(packB + "B.java", true); + + IType focus = javaProject2.findType("b.B"); + ITypeHierarchy hierarchy = focus.newTypeHierarchy(this.workingCopies, null); + IType[] allSuperTypes = hierarchy.getAllSupertypes(focus); + assertTypesEqual("Incorrect super hierarchy", + "a.A\n" + + "java.lang.Object\n", + allSuperTypes, + true); + + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy(packA + "A.java", true); + + focus = javaProject1.findType("a.A"); + hierarchy = focus.newTypeHierarchy(this.workingCopies, null); + IType[] allSubTypes = hierarchy.getAllSubtypes(focus); + assertTypesEqual("Incorrect sub hierarchy", + "b.B\n", + allSubTypes, + true); + } finally{ + if (javaProject1 != null) deleteProject(javaProject1); + if (javaProject2 != null) deleteProject(javaProject2); + } +} } |