我正在学习开发 Intellij 插件,版本为 2018.2.5 Ultimate Edition。没有太多代码可以展示,因为它看起来像 Hello Word 示例。当我运行代码时,我遇到了下面给出的错误。
public class ImportAction extends AnAction {
@Override
public void actionPerformed(AnActionEvent e) {
}
@Override
public void update(@NotNull AnActionEvent e) {
super.update(e);
PsiFile file = e.getData(LangDataKeys.PSI_FILE);
Editor editor = e.getData(PlatformDataKeys.EDITOR_EVEN_IF_INACTIVE);
if (file == null || editor == null) {
e.getPresentation().setEnabled(false);
return;
}
int offset = editor.getCaretModel().getOffset();
PsiElement element = file.findElementAt(offset);
PsiClass psiClass = PsiTreeUtil.getParentOfType(element, PsiClass.class);
if (psiClass == null) {
e.getPresentation().setEnabled(false);
}
}
}
当我运行项目时,另一个 Intellij 打开,但是当我选择一个项目或创建新项目时,什么也没有发生。
最佳答案
您需要使用 JDK 8,而不是 JDK 10 作为运行 IntelliJ IDEA 调试实例的 JDK。
关于java - com.intellij.ide.ClassUtilCore 对 sun.net.www.protocol.jar.JarFileFactory.fileCache 字段进行非法反射访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53003952/