gpt4 book ai didi

java - com.intellij.ide.ClassUtilCore 对 sun.net.www.protocol.jar.JarFileFactory.fileCache 字段进行非法反射访问

转载 作者:行者123 更新时间:2023-12-01 19:46:38 24 4
gpt4 key购买 nike

我正在学习开发 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);
}
}
}

Error

项目结构 enter image description here

当我运行项目时,另一个 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com