如何解决IntelliJ 检查“未处理的异常”和其他多个错误,但项目成功编译 Java SDK 1.6
平台:IntelliJ 社区版 2020.3
项目/模块 SDK:jdk1.6.0_45
项目语言级别:6 - 接口中的@Override
模块依赖:jdk1.6.0_45
操作系统:Windows 10
对于这个旧的源代码库,从 Eclipse 移动到 IntelliJ & 我可以看到很多错误,但是当我构建项目时,它可以正确编译。我该如何摆脱这些错误,我无法更新所有类以添加 throw/catch/method 参数注释等。此外,这不是基于 maven 的项目。
Errors: Unhandled exception,Cannot resolve symbol,etc
我到目前为止所做的,阅读其他人的建议:
File > Invalidate Caches and restart the IDE 3-4 times
-
File > Settings > Build,Execution,Deployment > Compiler > Java Compiler >
Changed Project
& Target Bytecode Version to 6
来自.idea dir
的一些文件
misc.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" project-jdk-name="1.6" project-jdk-type="JavaSDK" />
</project>
mySourceCode.iml
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6">
<output url="file://$MODULE_DIR$/out/production/mySourceCode" />
<output-test url="file://$MODULE_DIR$/out/test/mySourceCode" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/out" />
</content>
<orderEntry type="jdk" jdkName="1.6" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Ext_Jars" level="application" />
</component>
</module>
module.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/mySourceCode.iml" filepath="$PROJECT_DIR$/.idea/mySourceCode.iml" />
</modules>
</component>
</project>
compiler.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<excludeFromCompile>
<file url="file://$PROJECT_DIR$/java/test/test.java" />
</excludeFromCompile>
<bytecodeTargetLevel target="6">
<module name="mySourceCode" target="6" />
</bytecodeTargetLevel>
</component>
</project>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。