Conflicting access to org.eclipse.jdt.internal.compiler.parser #4618
-
|
I have a small project with module-info.java having: requires transitive jdk.compiler;
requires transitive java.compiler;
requires transitive java.logging;
requires org.eclipse.osgi;
requires org.eclipse.equinox.common;
requires org.eclipse.jdt.core;
requires org.eclipse.jdt.core.compiler.batch;The code I am trying to compile: import javax.tools.DiagnosticCollector;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;
import javax.tools.ToolProvider;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;
String source = """
import mypackage.Log;
public class HelloWorld {
public static void empty() {
}
public void another(){
Log.DEBUG("message", 1, 2 ,3);
}
}
""";
ASTParser parser = ASTParser.newParser(AST.JLS17);
parser.setSource(source.toCharArray());
parser.setKind(ASTParser.K_COMPILATION_UNIT);
CompilationUnit unit = (CompilationUnit) parser.createAST(new NullProgressMonitor());
org.eclipse.jdt.internal.compiler.parser.Scanner s; // ERROR
unit.accept(new LogsRouter());However, I am getting an error in eclipse: If I remove the ERROR line to narrow down the issue, I get:
My question is how do I |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
If I remember right, the jars share few packages historically (the code was written ~ 10 years before module system was invented). @stephan-herrmann can probably have some idea how to fix that, I'm not a module expert. Maybe some magic in module-info needed. |
Beta Was this translation helpful? Give feedback.
-
|
I don't see a simple answer how to consume both jars in their current shape as modules. How did we get here?
What is the problem?
How can this be solved right now?
Can we improve this?
|
Beta Was this translation helpful? Give feedback.
I don't see a simple answer how to consume both jars in their current shape as modules.
How did we get here?