Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-05-15 21:46:27 +0000
committerStephan Herrmann2019-05-15 22:03:58 +0000
commit74f920117bbf1dae1650ebfa4577620e740d08e4 (patch)
treefb89b50e420ed64b2b5181b81b3af33ba05557e0
parent6e74704b020c324802ce193dc05f264ca8b04302 (diff)
downloadeclipse.jdt.core-74f920117bbf1dae1650ebfa4577620e740d08e4.tar.gz
eclipse.jdt.core-74f920117bbf1dae1650ebfa4577620e740d08e4.tar.xz
eclipse.jdt.core-74f920117bbf1dae1650ebfa4577620e740d08e4.zip
Bug 543604 - [9] Error when hovering a HashMap
- fix test isolation: don't delete project required by other tests! - added test variant trying to use project option Change-Id: I886d9cb0e27dd45c799e505cc8c1011a9bc27eeb
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java38
1 files changed, 36 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
index bba2f4865e..8c1afe12ba 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
@@ -3320,8 +3320,7 @@ public class ModuleBuilderTests extends ModifyingResourceTests {
// test that the compilation of a class using same package defined in the java.util module
// works if a special option is given
- public void test_no_conflicting_packages_for_debugger() throws CoreException {
- deleteProject("P1");
+ public void test_no_conflicting_packages_for_debugger_global() throws CoreException {
Hashtable<String, String> javaCoreOptions = JavaCore.getOptions();
try {
Hashtable<String, String> newOptions=new Hashtable<>(javaCoreOptions);
@@ -3343,11 +3342,46 @@ public class ModuleBuilderTests extends ModifyingResourceTests {
IJavaProject p1= setupModuleProject("debugger_project", sources, new IClasspathEntry[]{dep});
p1.getProject().getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null);
assertNoErrors();
+
+ assertNull("Option should not be stored", JavaCore.getOption(CompilerOptions.OPTION_JdtDebugCompileMode));
} finally {
deleteProject("debugger_project");
JavaCore.setOptions(javaCoreOptions);
}
}
+
+ // test that the special OPTION_JdtDebugCompileMode cannot be persisted on a project
+ public void test_no_conflicting_packages_for_debugger_project() throws CoreException {
+ try {
+ String[] sources = new String[] {
+ "src/java/util/Map___.java",
+ "package java.util;\n" +
+ "abstract class Map___ implements java.util.Map {\n" +
+ " Map___() {\n" +
+ " super();\n" +
+ " }\n" +
+ " Object[] ___run() throws Throwable {\n" +
+ " return entrySet().toArray();\n" +
+ " }\n" +
+ "}"
+ };
+ IClasspathEntry dep = JavaCore.newContainerEntry(new Path(JavaCore.MODULE_PATH_CONTAINER_ID));
+ IJavaProject p1= setupModuleProject("debugger_project", sources, new IClasspathEntry[]{dep});
+ p1.setOption(CompilerOptions.OPTION_JdtDebugCompileMode, JavaCore.ENABLED);
+ assertNull("Option should not be stored", p1.getOption(CompilerOptions.OPTION_JdtDebugCompileMode, false));
+ p1.getProject().getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ IMarker[] markers = p1.getProject().findMarkers(null, true, IResource.DEPTH_INFINITE);
+ sortMarkers(markers);
+ assertMarkers("Unexpected markers",
+ "The package java.util conflicts with a package accessible from another module: java.base\n" +
+ "The package java.util is accessible from more than one module: <unnamed>, java.base\n" +
+ "The method entrySet() is undefined for the type Map___",
+ markers);
+ } finally {
+ deleteProject("debugger_project");
+ }
+ }
+
// test that a package declared in a module conflicts with an accessible package
// of the same name declared in another required module
public void test_conflicting_packages_declaredvsaccessible() throws CoreException {

Back to the top