简体   繁体   English

如何禁用 IntelliJ IDEA 烦人的检查 (JAVA)

[英]How to disable IntelliJ IDEA annoying inspections (JAVA)

version: IntelliJ IDEA Community Edition 2020.1.2版本:IntelliJ IDEA 社区版 2020.1.2

There is an error that occurred in Intellij but Eclipse not. Intellij 中发生错误,但 Eclipse 没有。

According to the below code, the variable is StringBuilder and it's okay to append an integer or an int by the book.根据下面的代码,变量是 StringBuilder ,可以 append 和 integer 或书上的 int 。

But why Intellij shows me this error?但为什么 Intellij 向我显示此错误? How to disable the inspections and make the red line disappeaded.如何禁用检查并使红线消失。

By the way, that code looks fine in eclipse.顺便说一句,该代码在 eclipse 中看起来不错。

在此处输入图像描述

my sameaple code我的相同代码

public class test123 {
    public static void main(String[] args) {
        StringBuilder msg = new StringBuilder();
        Double rate = new Double(123);
        msg.append(rate == 0 ? (rate == 0 ? 0 : "-" + rate) : String.valueOf(Math.round(rate*100)).replace("0", "") + "折");
System.out.printf("yyuu:"+msg.toString());
    }

在此处输入图像描述 screenshot截屏

} }

The issue seems to be the IntelliJ IDEA bug, javac and eclipse compilers compile the code without errors, though Editor shows the error.问题似乎是 IntelliJ IDEA 错误,javac 和 eclipse 编译器编译代码没有错误,尽管编辑器显示错误。

Please follow the issue created for the bug: https://youtrack.jetbrains.com/issue/IDEA-244854请关注为该错误创建的问题: https://youtrack.jetbrains.com/issue/IDEA-244854

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

相关问题 如何禁用IntelliJ IDEA的编译错误检查 - How to disable inspections of compile error of IntelliJ IDEA Intellij IDEA的检查和描述清单? - List of Inspections & descriptions in Intellij IDEA? 如何以编程方式从 Intellij Idea 插件获取 intellij Idea 中的检查或静态代码分析错误? - How to get inspections or static code analysis errors in intellij Idea from Intellij Idea Plugin programmatically? 如何在 IntelliJ IDEA 中为 Maven Java 项目禁用 Kotlin 编译器? - How to disable Kotlin compiler in IntelliJ IDEA for Maven Java projects? 如何使IntelliJ Idea仅显示编译器生成的警告和禁止智能检查? - How to make IntelliJ Idea display only compiler generated warnings and supress intelligent inspections? 如何在 IntelliJ Idea 中禁用 Gradle 守护进程? - How to disable Gradle daemon in IntelliJ Idea? 如何在 IntelliJ IDEA 中禁用代码检查 - How to disable code inspection in IntelliJ IDEA 如何在IntelliJ IDEA中禁用JavaDoc的格式 - How to disable formatting for JavaDoc in IntelliJ IDEA 如何在 IntelliJ IDEA 中禁用“粘贴时将 Java 转换为 Kotlin”? - How do I disable 'Convert Java to Kotlin upon paste' in IntelliJ IDEA? 在 Intellij Idea 中禁用 java doc 自动格式化。 2019年 - Disable java doc auto formatting in Intellij Idea. 2019
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM