简体   繁体   English

IDEA IntelliJ 显示消息“不兼容的类型”并且无法修复错误

[英]IDEA IntelliJ show message "Incompatible type" and can not fix error

图片显示错误

I have tried to click on suggestion action of IDE but it didn't change any thing and error still there.我试图点击 IDE 的建议操作,但它没有改变任何东西并且错误仍然存在。 There are same class and library.有相同的 class 和库。 It's so confusing.这太令人困惑了。

Is that a problem of IDE or can I turn off that error inspection?这是 IDE 的问题还是我可以关闭该错误检查?
This is the error message:这是错误消息:

Required type:所需类型:
org.springframework.web.client.RestTemplate org.springframework.web.client.RestTemplate
Provided:假如:
org.springframework.web.client.RestTemplate org.springframework.web.client.RestTemplate

I clicked on Quick Fix but it didn't change any thing.我点击了快速修复,但它没有改变任何东西。

It's okay when I run or debug all projects.当我运行或调试所有项目时没关系。 I just want to turn off that error of IDE, it always show error when I code我只是想关闭IDE的那个错误,我编码时总是显示错误

You should be able to disable specific inspections, as per Jetbrains Website .根据Jetbrains 网站,您应该能够禁用特定检查。 The easiest way is probably this one:最简单的方法可能是这个:

Disable an inspection in the editor在编辑器中禁用检查

  1. Place the caret at the highlighted line and press Alt+Enter (or click the Intention action icon to use the intention action).将插入符号放在突出显示的行并按 Alt+Enter(或单击意图操作图标以使用意图操作)。

  2. Click the arrow next to the inspection you want to disable, and select Disable inspection .单击要禁用的检查旁边的箭头,然后单击 select禁用检查

Alternatively, you can also suppress inspections:或者,您也可以禁止检查:

When you suppress an inspection, the code analysis engine doesn't highlight the problem found by this inspection in the specific piece of code (class, method, field, or statement).当您禁止检查时,代码分析引擎不会在特定代码(类、方法、字段或语句)中突出显示此检查发现的问题。 You can also suppress all inspections in the current class.您还可以抑制当前 class 中的所有检查。

After you suppress an inspection, IntelliJ IDEA adds a new element before the selected symbol.抑制检查后,IntelliJ IDEA 会在所选符号之前添加一个新元素。

For example in Java, if you suppress an inspection for a class, a method, or a field, the IDE adds the @SuppressWarnings annotation.例如,在 Java 中,如果您禁止检查 class、方法或字段,则 IDE 会添加 @SuppressWarnings 注释。

Suppress an inspection in the editor禁止编辑器中的检查

  1. Place the caret at the highlighted line and press Alt+Enter (or click the Intention action icon to use the intention action).将插入符号放在突出显示的行并按 Alt+Enter(或单击意图操作图标以使用意图操作)。

  2. Click the arrow next to the inspection you want to suppress, and select the necessary suppress action.单击要抑制的检查旁边的箭头,然后单击 select 必要的抑制操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IntelliJ IDEA 12-不兼容的Android版本错误 - IntelliJ IDEA 12 - Incompatible Android version error 如何修复错误加载项目:无法在 Intellij IDEA 中加载 facet Spring? - How can I fix Error Loading Project: Cannot load facet Spring in Intellij IDEA? INTELLIJ IDEA 错误:“无法启动 Git:/usr/bin/git 可能 Git 可执行文件的路径无效。修复它。” 如何修复? - INTELLIJ IDEA ERROR: "Can't start Git: /usr/bin/git Probably the path to Git executable is not valid. Fix it." How to Fix it? 错误消息的含义是什么:返回类型不兼容 - What is the meaning of error message: The return type is incompatible intellij-idea的父目录中是否有任何功能或设置可以显示编译错误 - Is there any feature or setting can show compile error in parent directory in intellij-idea 修复 Intellij Idea 下载源连接拒绝主机 127.0.0.1 错误 - Fix Intellij Idea download sources Connection Refused to host 127.0.0.1 error 获取Intellij Idea以突出显示不兼容的编译器代码? - Get Intellij Idea to highlight incompatible compiler code? 在设计时在IntelliJ Idea中记录消息/错误? - Log message/error at design-time in IntelliJ Idea? IntelliJ IDEA快速修复自定义 - IntelliJ IDEA Quick Fix Customization IntelliJ IDEA 13给出了关于不兼容类型的无效错误(Play中的Java-Scala-InterOp) - IntelliJ IDEA 13 gives invalid error about incompatible types (Java-Scala-InterOp in Play)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM