在使用com.sun.tools.javac.util中的类或接口之前,需要在模块描述文件(module-info.java)中将该package导出。例如:
module myModule { requires jdk.compiler; exports com.example.mypackage; exports com.sun.tools.javac.util; //添加该项导出 }
其中,exports关键字用于导出模块中的代码,使其在其他模块中可见。添加该项导出之后,在编译时就可以正常使用com.sun.tools.javac.util中的类和接口了。