我正试图从中访问List该类com.sun.tools.javac.util.这适用于Java 8,但是当切换到Java 9时,我收到以下错误:Package 'com.sun.tools.javac.util' is declared in module "jdk.compiler", which does not export it to the unnamed module".
我尝试添加requires jdk.compiler;到我的module-info文件,但这并没有解决问题.
I am modifying an existing class using internal sun APIs (com.sun.tools.javac) with an annotation processor. I am able to generate and add a MethodDecl to a ClassDecl using the following code:
JCTree.JCClassDecl classDecl = ...
JCTree.JCMethodDecl methodDecl = ...
JCTree[] trees = new JCTree[classDecl.defs.length() + 1];
trees[classDecl.defs.length()] = methodDecl;
classDecl.defs = List.from(trees);
Run Code Online (Sandbox Code Playgroud)
This works fine until I try to add parameters to the method declaration. I use the following code to generate a new MethodDecl:
Map<String, Class<?>> …Run Code Online (Sandbox Code Playgroud)