Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPTION_JdtDebugCompileMode has surprising effects on imports #1141

Closed
wants to merge 3 commits into from

Conversation

trancexpress
Copy link
Contributor

Replace OPTION_JdtDebugCompileMode with
OPTION_IgnoreUnnamedModuleForSplitPackage, to avoid unexpected effects from the first.

What it does

How to test

Author checklist

@trancexpress
Copy link
Contributor Author

trancexpress commented Jun 12, 2023

Seems to cause problems at least in: ModuleBuilderTests.test_no_conflicting_packages_for_debugger_global()

I'll see when I can look into this.

Must be done after: eclipse-jdt/eclipse.jdt.debug#261

@trancexpress
Copy link
Contributor Author

@stephan-herrmann do you have time to look into the remaining test fail?

	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);
			newOptions.put(CompilerOptions.OPTION_IgnoreUnnamedModuleForSplitPackage, JavaCore.ENABLED);
			JavaCore.setOptions(newOptions);
			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.getProject().getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null);
			assertNoErrors();
		} finally {
			deleteProject("debugger_project");
			JavaCore.setOptions(javaCoreOptions);
		}
	}

The error is produced by: ImportReference.checkPackageConflict(CompilationUnitScope)

There is no check anymore there, whether to produce the split package error. So it does produce the error. Is the code supposed to not run at all, or must it check if the unnamed module is part of the conflict and then (depending on the new compiler option) not report the error?

@stephan-herrmann stephan-herrmann self-requested a review September 16, 2023 20:08
Replace OPTION_JdtDebugCompileMode with
OPTION_IgnoreUnnamedModuleForSplitPackage, to avoid unexpected effects
from the first.

Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
@stephan-herrmann
Copy link
Contributor

@trancexpress are we ready for removing "Draft" and a final review? (Haven't yet looked at all changes).

@stephan-herrmann
Copy link
Contributor

In light of eclipse-jdt/eclipse.jdt.debug#309 this change is not a good idea.

Superseded by the opposite: #2340

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants