-
Notifications
You must be signed in to change notification settings - Fork 139
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
ASTParser sometimes failing at resolving package with modules #2301
Comments
Here is another example, which can be run from ReconcilerTests9 public void testBug544306_ASTParser() throws Exception {
if (!isJRE9)
return;
IJavaProject p1 = createJava9Project("p1");
IJavaProject p2 = createJava9Project("p2");
try {
createFolder("p1/src/p1");
createFile("p1/src/p1/P1.java",
"package p1;\n" +
"public class P1 {\n" +
"}\n");
createFile("p1/src/module-info.java",
"module p1 {\n" +
" exports p1;\n" +
"}\n");
IClasspathAttribute[] testAttrs = { JavaCore.newClasspathAttribute("test", "true") };
addClasspathEntry(p2, JavaCore.newProjectEntry(p1.getPath(), null, false, testAttrs, false));
addClasspathEntry(p2, JavaCore.newSourceEntry(new Path("/p2/src-test"), null, null, new Path("/p2/bin-test"), testAttrs));
createFolder("p2/src/p2");
createFolder("p2/src-test/p2");
createFile("p2/src/module-info.java",
"module p2 {\n" +
"}\n");
String testSource = "package p2;\n" +
"import p1.P1;\n" +
"class Test extends P1{ }";
createFile("p2/src-test/p2/Test.java", testSource);
waitForAutoBuild();
IMarker[] markers = p1.getProject().findMarkers(null, true, IResource.DEPTH_INFINITE);
assertMarkers("Unexpected markers",
"", markers);
this.workingCopy.discardWorkingCopy();
this.workingCopy = getCompilationUnit("p2/src-test/p2/Test.java").getWorkingCopy(this.wcOwner, null);
ASTParser parser = ASTParser.newParser(AST.getJLSLatest());
parser.setResolveBindings(true);
parser.setSource(this.workingCopy);
parser.setWorkingCopyOwner(this.wcOwner);
CompilationUnit unit = (CompilationUnit)parser.createAST(null);
assertArrayEquals(new IProblem[0], unit.getProblems());
this.workingCopy.discardWorkingCopy();
} finally {
deleteProject(p1);
deleteProject(p2);
}
} |
Coming from #3273 (comment) I wanted to check the status of this (due to connection to StackOverflowError):
Observations: On HEAD of master (before #3384) this test throws ISE("Missing system library"), likely due to unconfigured @mickaelistria do you have any further hints? The original stack trace? Note that |
Sorry, I have lost memory about this case and won't spend further time on it on short term. So if you think it's better, feel free to close it. If needed, I'll reopen or recreate it later. |
Add this to ModuleBuilderTests
and see it wrongly fail with
When working on this with #2300, the proposed quickfix was causing a StackOverflowError that can be reproduced when applying the patch and running this from ResolveTests9
The text was updated successfully, but these errors were encountered: