1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-03-25 18:15:41 +01:00
IntelliJ-IdeaVim/qodana.sarif.json
2024-02-23 15:38:33 +02:00

110555 lines
5.6 MiB
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"$schema": "https://raw.githubusercontent.com/schemastore/schemastore/master/src/schemas/json/sarif-2.1.0-rtm.5.json",
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "QDJVM",
"fullName": "Qodana for JVM",
"version": "233.14714.239",
"rules": [],
"taxa": [
{
"id": "Language injection",
"name": "Language injection"
},
{
"id": "JVM languages",
"name": "JVM languages"
},
{
"id": "Kotlin",
"name": "Kotlin"
},
{
"id": "Kotlin/Style issues",
"name": "Style issues",
"relationships": [
{
"target": {
"id": "Kotlin",
"index": 2,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Kotlin/Redundant constructs",
"name": "Redundant constructs",
"relationships": [
{
"target": {
"id": "Kotlin",
"index": 2,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java",
"name": "Java"
},
{
"id": "Java/Internationalization",
"name": "Internationalization",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Spring",
"name": "Spring"
},
{
"id": "Spring/Spring Core",
"name": "Spring Core",
"relationships": [
{
"target": {
"id": "Spring",
"index": 7,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Spring/Spring Core/XML",
"name": "XML",
"relationships": [
{
"target": {
"id": "Spring/Spring Core",
"index": 8,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Performance",
"name": "Performance",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Code style issues",
"name": "Code style issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Declaration redundancy",
"name": "Declaration redundancy",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Spring/Spring Core/Code",
"name": "Code",
"relationships": [
{
"target": {
"id": "Spring/Spring Core",
"index": 8,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Error handling",
"name": "Error handling",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Probable bugs",
"name": "Probable bugs",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Kotlin/Migration",
"name": "Migration",
"relationships": [
{
"target": {
"id": "Kotlin",
"index": 2,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Spring/Spring Cloud",
"name": "Spring Cloud",
"relationships": [
{
"target": {
"id": "Spring",
"index": 7,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript",
"name": "JavaScript and TypeScript"
},
{
"id": "JavaScript and TypeScript/Unit testing",
"name": "Unit testing",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Serialization issues",
"name": "Serialization issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Class structure",
"name": "Class structure",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Groovy",
"name": "Groovy"
},
{
"id": "Groovy/GPath",
"name": "GPath",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Imports",
"name": "Imports",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Maven",
"name": "Maven"
},
{
"id": "JSON and JSON5",
"name": "JSON and JSON5"
},
{
"id": "MySQL",
"name": "MySQL"
},
{
"id": "Kotlin/Probable bugs",
"name": "Probable bugs",
"relationships": [
{
"target": {
"id": "Kotlin",
"index": 2,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Threading issues",
"name": "Threading issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Control flow issues",
"name": "Control flow issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Numeric issues",
"name": "Numeric issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JPA",
"name": "JPA"
},
{
"id": "Java/Initialization",
"name": "Initialization",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Sass_SCSS",
"name": "Sass/SCSS"
},
{
"id": "HTML",
"name": "HTML"
},
{
"id": "JavaScript and TypeScript/Unused symbols",
"name": "Unused symbols",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Flow type checker",
"name": "Flow type checker",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Security",
"name": "Security",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Properties files",
"name": "Properties files"
},
{
"id": "PostCSS",
"name": "PostCSS"
},
{
"id": "JavaScript and TypeScript/Bitwise operation issues",
"name": "Bitwise operation issues",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Groovy/Naming conventions",
"name": "Naming conventions",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/General",
"name": "General",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Packaging issues",
"name": "Packaging issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Reactive Streams",
"name": "Reactive Streams"
},
{
"id": "Reactive Streams/Common",
"name": "Common",
"relationships": [
{
"target": {
"id": "Reactive Streams",
"index": 45,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Verbose or redundant code constructs",
"name": "Verbose or redundant code constructs",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "General",
"name": "General"
},
{
"id": "Gradle",
"name": "Gradle"
},
{
"id": "Gradle/Probable bugs",
"name": "Probable bugs",
"relationships": [
{
"target": {
"id": "Gradle",
"index": 49,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "FreeMarker",
"name": "FreeMarker"
},
{
"id": "JVM languages/Logging",
"name": "Logging",
"relationships": [
{
"target": {
"id": "JVM languages",
"index": 1,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "EditorConfig",
"name": "EditorConfig"
},
{
"id": "JavaScript and TypeScript/Validity issues",
"name": "Validity issues",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Gradle/Validity issues",
"name": "Validity issues",
"relationships": [
{
"target": {
"id": "Gradle",
"index": 49,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Code maturity",
"name": "Code maturity",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Potentially confusing code constructs",
"name": "Potentially confusing code constructs",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SQL",
"name": "SQL"
},
{
"id": "Spring/Spring Data",
"name": "Spring Data",
"relationships": [
{
"target": {
"id": "Spring",
"index": 7,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Groovy/Probable bugs",
"name": "Probable bugs",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Kotlin/Other problems",
"name": "Other problems",
"relationships": [
{
"target": {
"id": "Kotlin",
"index": 2,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Try statement issues",
"name": "Try statement issues",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Plugin DevKit",
"name": "Plugin DevKit"
},
{
"id": "Plugin DevKit/Workspace model",
"name": "Workspace model",
"relationships": [
{
"target": {
"id": "Plugin DevKit",
"index": 63,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Data flow",
"name": "Data flow",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Ktor",
"name": "Ktor"
},
{
"id": "CDI (Contexts and Dependency Injection)",
"name": "CDI (Contexts and Dependency Injection)"
},
{
"id": "Velocity",
"name": "Velocity"
},
{
"id": "Plugin DevKit/Code",
"name": "Code",
"relationships": [
{
"target": {
"id": "Plugin DevKit",
"index": 63,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids",
"name": "Java language level migration aids",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids/Java 20",
"name": "Java 20",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Kotlin/Naming conventions",
"name": "Naming conventions",
"relationships": [
{
"target": {
"id": "Kotlin",
"index": 2,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CSS",
"name": "CSS"
},
{
"id": "CSS/Invalid elements",
"name": "Invalid elements",
"relationships": [
{
"target": {
"id": "CSS",
"index": 73,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Potentially undesirable code constructs",
"name": "Potentially undesirable code constructs",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Finalization",
"name": "Finalization",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Logging",
"name": "Logging",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Modularization issues",
"name": "Modularization issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Javadoc",
"name": "Javadoc",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Kotlin/Java interop issues",
"name": "Java interop issues",
"relationships": [
{
"target": {
"id": "Kotlin",
"index": 2,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Naming conventions",
"name": "Naming conventions",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Naming conventions/Class",
"name": "Class",
"relationships": [
{
"target": {
"id": "Java/Naming conventions",
"index": 81,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Hibernate",
"name": "Hibernate"
},
{
"id": "Spring/Spring Integration",
"name": "Spring Integration",
"relationships": [
{
"target": {
"id": "Spring",
"index": 7,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Plugin DevKit/Plugin descriptor",
"name": "Plugin descriptor",
"relationships": [
{
"target": {
"id": "Plugin DevKit",
"index": 63,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Abstraction issues",
"name": "Abstraction issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Assignment issues",
"name": "Assignment issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids/Java 9",
"name": "Java 9",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Groovy/Threading issues",
"name": "Threading issues",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Groovy/Control flow issues",
"name": "Control flow issues",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/JUnit",
"name": "JUnit",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "XSLT",
"name": "XSLT"
},
{
"id": "Groovy/Style",
"name": "Style",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java EE",
"name": "Java EE"
},
{
"id": "Java/Portability",
"name": "Portability",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/TestNG",
"name": "TestNG",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Assignment issues",
"name": "Assignment issues",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JSP",
"name": "JSP"
},
{
"id": "Java/Visibility",
"name": "Visibility",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RegExp",
"name": "RegExp"
},
{
"id": "Java/Concurrency annotation issues",
"name": "Concurrency annotation issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CSS/Probable bugs",
"name": "Probable bugs",
"relationships": [
{
"target": {
"id": "CSS",
"index": 73,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/TypeScript",
"name": "TypeScript",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Lombok",
"name": "Lombok",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Lombok/Redundant modifiers",
"name": "Redundant modifiers",
"relationships": [
{
"target": {
"id": "Java/Lombok",
"index": 104,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UI form",
"name": "UI form"
},
{
"id": "JavaScript and TypeScript/ES2015 migration aids",
"name": "ES2015 migration aids",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Naming conventions/Method",
"name": "Method",
"relationships": [
{
"target": {
"id": "Java/Naming conventions",
"index": 81,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/DOM issues",
"name": "DOM issues",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Probable bugs",
"name": "Probable bugs",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Code Coverage",
"name": "Code Coverage"
},
{
"id": "Groovy/Annotations",
"name": "Annotations",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Proofreading",
"name": "Proofreading"
},
{
"id": "XML",
"name": "XML"
},
{
"id": "Java/Cloning issues",
"name": "Cloning issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Manifest",
"name": "Manifest"
},
{
"id": "Groovy/Potentially confusing code constructs",
"name": "Potentially confusing code constructs",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Groovy/Error handling",
"name": "Error handling",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids/Java 5",
"name": "Java 5",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids/Java 8",
"name": "Java 8",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JVM languages/Test frameworks",
"name": "Test frameworks",
"relationships": [
{
"target": {
"id": "JVM languages",
"index": 1,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Groovy/Assignment issues",
"name": "Assignment issues",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Class metrics",
"name": "Class metrics",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RESTful Web Service (JAX-RS)",
"name": "RESTful Web Service (JAX-RS)"
},
{
"id": "Java/Encapsulation",
"name": "Encapsulation",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Control flow issues",
"name": "Control flow issues",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Test frameworks",
"name": "Test frameworks",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Reflective access",
"name": "Reflective access",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids/Java 15",
"name": "Java 15",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Code quality tools",
"name": "Code quality tools",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Spring/Spring AOP",
"name": "Spring AOP",
"relationships": [
{
"target": {
"id": "Spring",
"index": 7,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Method metrics",
"name": "Method metrics",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Resource management",
"name": "Resource management",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Switch statement issues",
"name": "Switch statement issues",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids/Java 14",
"name": "Java 14",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Numeric issues/Cast",
"name": "Cast",
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Plugin DevKit/Description file",
"name": "Description file",
"relationships": [
{
"target": {
"id": "Plugin DevKit",
"index": 63,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/JavaBeans issues",
"name": "JavaBeans issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Pattern validation",
"name": "Pattern validation"
},
{
"id": "JavaScript and TypeScript/Function metrics",
"name": "Function metrics",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Code style issues",
"name": "Code style issues",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Dependency issues",
"name": "Dependency issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level issues",
"name": "Java language level issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "HTML/Accessibility",
"name": "Accessibility",
"relationships": [
{
"target": {
"id": "HTML",
"index": 35,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Groovy/Method metrics",
"name": "Method metrics",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "XPath",
"name": "XPath"
},
{
"id": "Java/Inheritance issues",
"name": "Inheritance issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Security",
"name": "Security"
},
{
"id": "JavaScript and TypeScript/Security",
"name": "Security",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AOP",
"name": "AOP"
},
{
"id": "Bean Validation",
"name": "Bean Validation"
},
{
"id": "Reactive Streams/Reactor",
"name": "Reactor",
"relationships": [
{
"target": {
"id": "Reactive Streams",
"index": 45,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Oracle",
"name": "Oracle"
},
{
"id": "Kotlin/Migration/Maven",
"name": "Maven",
"relationships": [
{
"target": {
"id": "Kotlin/Migration",
"index": 16,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Internationalization",
"name": "Internationalization"
},
{
"id": "Vue",
"name": "Vue"
},
{
"id": "Java/Java language level migration aids/Java 10",
"name": "Java 10",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids/Java 7",
"name": "Java 7",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Compiler issues",
"name": "Compiler issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Version control",
"name": "Version control"
},
{
"id": "MongoJS",
"name": "MongoJS"
},
{
"id": "Kotlin/Migration/Gradle",
"name": "Gradle",
"relationships": [
{
"target": {
"id": "Kotlin/Migration",
"index": 16,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Memory",
"name": "Memory",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Structural search",
"name": "Structural search"
},
{
"id": "Spring/Spring Security",
"name": "Spring Security",
"relationships": [
{
"target": {
"id": "Spring",
"index": 7,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "YAML",
"name": "YAML"
},
{
"id": "Java/Performance/Embedded",
"name": "Embedded",
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Imports and dependencies",
"name": "Imports and dependencies",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Probable bugs/Nullability problems",
"name": "Nullability problems",
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Spring/Spring Boot",
"name": "Spring Boot",
"relationships": [
{
"target": {
"id": "Spring",
"index": 7,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RELAX NG",
"name": "RELAX NG"
},
{
"id": "Java/Properties files",
"name": "Properties files",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Spring/Spring Cloud Stream",
"name": "Spring Cloud Stream",
"relationships": [
{
"target": {
"id": "Spring",
"index": 7,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids/Java 11",
"name": "Java 11",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PostgreSQL",
"name": "PostgreSQL"
},
{
"id": "SQL server",
"name": "SQL server"
},
{
"id": "Groovy/Data flow",
"name": "Data flow",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Async code and promises",
"name": "Async code and promises",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Naming conventions",
"name": "Naming conventions",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Qodana",
"name": "Qodana"
},
{
"id": "Dependency analysis",
"name": "Dependency analysis"
},
{
"id": "EL",
"name": "EL"
},
{
"id": "Java/Java language level migration aids/Java 16",
"name": "Java 16",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Shell script",
"name": "Shell script"
},
{
"id": "JavaScript and TypeScript/Data flow",
"name": "Data flow",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/React",
"name": "React",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Lombok/Redundant definitions",
"name": "Redundant definitions",
"relationships": [
{
"target": {
"id": "Java/Lombok",
"index": 104,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Spring/Spring MVC",
"name": "Spring MVC",
"relationships": [
{
"target": {
"id": "Spring",
"index": 7,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CSS/Code style issues",
"name": "Code style issues",
"relationships": [
{
"target": {
"id": "CSS",
"index": 73,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids/Java 19",
"name": "Java 19",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Less",
"name": "Less"
},
{
"id": "Groovy/Other",
"name": "Other",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Reactive Streams/Mutiny",
"name": "Mutiny",
"relationships": [
{
"target": {
"id": "Reactive Streams",
"index": 45,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Bitwise operation issues",
"name": "Bitwise operation issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Groovy/Validity issues",
"name": "Validity issues",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/Java language level migration aids/Java 21",
"name": "Java 21",
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Kotlin/Logging",
"name": "Logging",
"relationships": [
{
"target": {
"id": "Kotlin",
"index": 2,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaScript and TypeScript/Node.js",
"name": "Node.js",
"relationships": [
{
"target": {
"id": "JavaScript and TypeScript",
"index": 18,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java/toString() issues",
"name": "toString() issues",
"relationships": [
{
"target": {
"id": "Java",
"index": 5,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CSS/Code quality tools",
"name": "Code quality tools",
"relationships": [
{
"target": {
"id": "CSS",
"index": 73,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Kotlin/React",
"name": "React",
"relationships": [
{
"target": {
"id": "Kotlin",
"index": 2,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Kotlin/React/Probable bugs",
"name": "Probable bugs",
"relationships": [
{
"target": {
"id": "Kotlin/React",
"index": 201,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Gradle/Best practises",
"name": "Best practises",
"relationships": [
{
"target": {
"id": "Gradle",
"index": 49,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Groovy/Declaration redundancy",
"name": "Declaration redundancy",
"relationships": [
{
"target": {
"id": "Groovy",
"index": 22,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
}
],
"language": "en-US",
"contents": [
"localizedData",
"nonLocalizedData"
],
"isComprehensive": false
},
"extensions": [
{
"name": "org.intellij.intelliLang",
"version": "233.14714",
"rules": [
{
"id": "InjectionNotApplicable",
"shortDescription": {
"text": "Injection Annotation not applicable"
},
"fullDescription": {
"text": "Reports when a '@Language' annotation is applied to an element with a type other than 'String' or 'String[]'. Example: '@Language(\"HTML\") int i;' After the quick-fix is applied: 'int i;'",
"markdown": "Reports when a `@Language` annotation is applied to an element with a type other than `String` or `String[]`.\n\n**Example:**\n\n\n @Language(\"HTML\") int i;\n\nAfter the quick-fix is applied:\n\n\n int i;\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "error",
"parameters": {
"suppressToolId": "InjectionNotApplicable",
"ideaSeverity": "ERROR",
"qodanaSeverity": "Critical"
}
},
"relationships": [
{
"target": {
"id": "Language injection",
"index": 0,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PatternOverriddenByNonAnnotatedMethod",
"shortDescription": {
"text": "Non-annotated Method overrides @Pattern Method"
},
"fullDescription": {
"text": "Reports when a method without any '@Pattern' annotation overrides a '@Pattern' annotated method. This does not prevent error-highlighting inside the editor, however the overriding method will not be checked at runtime. A quick fix is provided to add a '@Pattern' annotation that matches the one from the superclass method. This ensures the runtime-check instrumentation works correctly. Example: 'abstract class Parent {\n abstract @Pattern(\"\\\\d\\\\d-\\\\d\\\\d\\\\d\") String getId();\n }\n class Child extends Parent {\n @Override String getId() { // warning here\n return \"12-345\";\n }\n }'",
"markdown": "Reports when a method without any `@Pattern` annotation overrides a `@Pattern` annotated method. This does not prevent error-highlighting inside the editor, however the overriding method will not be checked at runtime.\n\n\nA quick fix is provided to add a `@Pattern` annotation that matches the one from the superclass method. This ensures the\nruntime-check instrumentation works correctly.\n\n**Example:**\n\n\n abstract class Parent {\n abstract @Pattern(\"\\\\d\\\\d-\\\\d\\\\d\\\\d\") String getId();\n }\n class Child extends Parent {\n @Override String getId() { // warning here\n return \"12-345\";\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "PatternOverriddenByNonAnnotatedMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Pattern validation",
"index": 139,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InjectedReferences",
"shortDescription": {
"text": "Injected references"
},
"fullDescription": {
"text": "Reports unresolved references injected by Language Injections. Example: '@Language(\"file-reference\")\n String fileName = \"/home/user/nonexistent.file\"; // highlighted if file doesn't exist'",
"markdown": "Reports unresolved references injected by [Language Injections](https://www.jetbrains.com/help/idea/using-language-injections.html).\n\nExample:\n\n\n @Language(\"file-reference\")\n String fileName = \"/home/user/nonexistent.file\"; // highlighted if file doesn't exist\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "error",
"parameters": {
"suppressToolId": "InjectedReferences",
"ideaSeverity": "ERROR",
"qodanaSeverity": "Critical"
}
},
"relationships": [
{
"target": {
"id": "General",
"index": 48,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PatternNotApplicable",
"shortDescription": {
"text": "Pattern Annotation not applicable"
},
"fullDescription": {
"text": "Reports when a '@Pattern' annotation is applied to an element with a type other than 'String'. Example: '@Pattern(\"\\\\d\\\\d\") int i;'",
"markdown": "Reports when a `@Pattern` annotation is applied to an element with a type other than `String`.\n\n**Example:**\n\n\n @Pattern(\"\\\\d\\\\d\") int i;\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "error",
"parameters": {
"suppressToolId": "PatternNotApplicable",
"ideaSeverity": "ERROR",
"qodanaSeverity": "Critical"
}
},
"relationships": [
{
"target": {
"id": "Pattern validation",
"index": 139,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnknownLanguage",
"shortDescription": {
"text": "Unknown Language ID"
},
"fullDescription": {
"text": "Reports when the ID of the language used in a '@Language' annotation is unknown. Example: '@Language(\"HMTL\") String html;'",
"markdown": "Reports when the ID of the language used in a `@Language` annotation is unknown.\n\n**Example:**\n\n\n @Language(\"HMTL\") String html;\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "error",
"parameters": {
"suppressToolId": "UnknownLanguage",
"ideaSeverity": "ERROR",
"qodanaSeverity": "Critical"
}
},
"relationships": [
{
"target": {
"id": "Language injection",
"index": 0,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PatternValidation",
"shortDescription": {
"text": "Validate annotated patterns"
},
"fullDescription": {
"text": "Reports expressions passed as arguments for '@Pattern' parameters and returned from '@Pattern'-annotated methods that do not match the specified pattern. Example: '@Pattern(\"\\\\d\\\\d-\\\\d\\\\d\\\\d\") String getId() {\n return \"1\";\n }' Use the Flag non compile-time constant expressions option to let the inspection report expressions with an unknown value and offer to add a substitution ('@Subst') annotation.",
"markdown": "Reports expressions passed as arguments for `@Pattern` parameters and returned from `@Pattern`-annotated methods that do not match the specified pattern.\n\n**Example:**\n\n\n @Pattern(\"\\\\d\\\\d-\\\\d\\\\d\\\\d\") String getId() {\n return \"1\";\n }\n\n\nUse the **Flag non compile-time constant expressions** option to let the inspection report expressions with\nan unknown value and offer to add a substitution (`@Subst`) annotation."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "PatternValidation",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Pattern validation",
"index": 139,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LanguageMismatch",
"shortDescription": {
"text": "Language mismatch"
},
"fullDescription": {
"text": "Reports when the language of a reference does not match the expected language of the usage context. Example: '@Language(\"JavaScript\")\n String JS_CODE = \"var x;\";\n\n @Language(\"XPath\")\n String XPATH_CODE = JS_CODE; // warning here'",
"markdown": "Reports when the language of a reference does not match the expected language of the usage context.\n\nExample:\n\n\n @Language(\"JavaScript\")\n String JS_CODE = \"var x;\";\n\n @Language(\"XPath\")\n String XPATH_CODE = JS_CODE; // warning here\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "LanguageMismatch",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Language injection",
"index": 0,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
}
],
"language": "en-US",
"contents": [
"localizedData",
"nonLocalizedData"
],
"isComprehensive": false
},
{
"name": "com.intellij.java",
"version": "233.14714",
"rules": [
{
"id": "OverrideOnly",
"shortDescription": {
"text": "Method can only be overridden"
},
"fullDescription": {
"text": "Reports calls to API methods marked with '@ApiStatus.OverrideOnly'. The '@ApiStatus.OverrideOnly' annotation indicates that the method is part of SPI (Service Provider Interface). Clients of the declaring library should implement or override such methods, not call them directly. Marking a class or interface with this annotation is the same as marking every method with it.",
"markdown": "Reports calls to API methods marked with `@ApiStatus.OverrideOnly`.\n\n\nThe `@ApiStatus.OverrideOnly` annotation indicates that the method is part of SPI (Service Provider Interface).\nClients of the declaring library should implement or override such methods, not call them directly.\nMarking a class or interface with this annotation is the same as marking every method with it."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "OverrideOnly",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages",
"index": 1,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CallToSuspiciousStringMethod",
"shortDescription": {
"text": "Call to suspicious 'String' method"
},
"fullDescription": {
"text": "Reports calls of: 'equals()' 'equalsIgnoreCase()' 'compareTo()' 'compareToIgnoreCase()' and 'trim()' on 'String' objects. Comparison of internationalized strings should probably use a 'java.text.Collator' instead. 'String.trim()' only removes control characters between 0x00 and 0x20. The 'String.strip()' method introduced in Java 11 is more Unicode aware and can be used as a replacement.",
"markdown": "Reports calls of:\n\n* `equals()`\n* `equalsIgnoreCase()`\n* `compareTo()`\n* `compareToIgnoreCase()` and\n* `trim()`\n\n\non `String` objects.\nComparison of internationalized strings should probably use a `java.text.Collator` instead.\n`String.trim()` only removes control characters between 0x00 and 0x20.\nThe `String.strip()` method introduced in Java 11 is more Unicode aware and can be used as a replacement."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CallToSuspiciousStringMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Internationalization",
"index": 6,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "KeySetIterationMayUseEntrySet",
"shortDescription": {
"text": "Iteration over 'keySet()' can be optimized"
},
"fullDescription": {
"text": "Reports iterations over the 'keySet()' of a 'java.util.Map' instance, where the iterated keys are used to retrieve the values from the map. Such iteration may be more efficient when replaced with an iteration over the 'entrySet()' or 'values()' (if the key is not actually used). Similarly, 'keySet().forEach(key -> ...)' can be replaced with 'forEach((key, value) -> ...)' if values are retrieved inside a lambda. Example: 'for (Object key : map.keySet()) {\n Object val = map.get(key);\n }' After the quick-fix is applied: 'for (Object val : map.values()) {}'",
"markdown": "Reports iterations over the `keySet()` of a `java.util.Map` instance, where the iterated keys are used to retrieve the values from the map.\n\n\nSuch iteration may be more efficient when replaced with an iteration over the\n`entrySet()` or `values()` (if the key is not actually used).\n\n\nSimilarly, `keySet().forEach(key -> ...)`\ncan be replaced with `forEach((key, value) -> ...)` if values are retrieved\ninside a lambda.\n\n**Example:**\n\n\n for (Object key : map.keySet()) {\n Object val = map.get(key);\n }\n\nAfter the quick-fix is applied:\n\n\n for (Object val : map.values()) {}\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "KeySetIterationMayUseEntrySet",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryQualifierForThis",
"shortDescription": {
"text": "Unnecessary qualifier for 'this' or 'super'"
},
"fullDescription": {
"text": "Reports unnecessary qualification of 'this' or 'super'. Using a qualifier on 'this' or 'super' to disambiguate a code reference may easily become unnecessary via automatic refactorings and should be deleted for clarity. Example: 'class Foo {\n void foo() {}\n }\n\n class Bar extends Foo {\n void bar() {\n Bar.super.foo();\n }\n }' After the quick-fix is applied: 'class Foo {\n void foo() {}\n }\n\n class Bar extends Foo {\n void bar() {\n super.foo();\n }\n }'",
"markdown": "Reports unnecessary qualification of `this` or `super`.\n\n\nUsing a qualifier on `this` or `super` to\ndisambiguate a code reference may easily become unnecessary via automatic refactorings and should be deleted for clarity.\n\n**Example:**\n\n\n class Foo {\n void foo() {}\n }\n\n class Bar extends Foo {\n void bar() {\n Bar.super.foo();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n void foo() {}\n }\n\n class Bar extends Foo {\n void bar() {\n super.foo();\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryQualifierForThis",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnusedReturnValue",
"shortDescription": {
"text": "Method can be made 'void'"
},
"fullDescription": {
"text": "Reports methods whose return values are never used when called. The return type of such methods can be made 'void'. Methods annotated with Error Prone's or AssertJ's '@CanIgnoreReturnValue' annotation will not be reported. The quick-fix updates the method signature and removes 'return' statements from inside the method. Example: '// reported if visibility setting is Protected or Public\n protected String myToUpperCase(String s) {\n return s.toUpperCase();\n }\n\n // simple setter, reporting depends on setting\n public String setStr(String str) {\n myStr = str;\n return myStr;\n }\n\n void test() {\n setStr(\"value\"); // return value is unused\n myToUpperCase(\"result\"); // return value is unused\n }' After the quick-fix is applied to both methods: 'protected void myToUpperCase(String s) {\n // 'return' removed completely\n // as 's.toUpperCase()' has no side effect\n }\n\n public void setStr(String str) {\n myStr = str;\n // 'return' removed\n }\n ...' NOTE: Some methods might not be reported during in-editor highlighting due to performance reasons. To see all results, run the inspection using Code | Inspect Code or Code | Analyze Code | Run Inspection by Name> Use the Ignore chainable methods option to ignore unused return values from chainable calls. Use the Maximal reported method visibility option to control the maximum visibility of methods to be reported.",
"markdown": "Reports methods whose return values are never used when called. The return type of such methods can be made `void`.\n\nMethods annotated with Error Prone's or AssertJ's `@CanIgnoreReturnValue` annotation will not be reported.\nThe quick-fix updates the method signature and removes `return` statements from inside the method.\n\n**Example:**\n\n\n // reported if visibility setting is Protected or Public\n protected String myToUpperCase(String s) {\n return s.toUpperCase();\n }\n\n // simple setter, reporting depends on setting\n public String setStr(String str) {\n myStr = str;\n return myStr;\n }\n\n void test() {\n setStr(\"value\"); // return value is unused\n myToUpperCase(\"result\"); // return value is unused\n }\n\nAfter the quick-fix is applied to both methods:\n\n\n protected void myToUpperCase(String s) {\n // 'return' removed completely\n // as 's.toUpperCase()' has no side effect\n }\n\n public void setStr(String str) {\n myStr = str;\n // 'return' removed\n }\n ...\n\n\n**NOTE:** Some methods might not be reported during in-editor highlighting due to performance reasons.\nTo see all results, run the inspection using **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name**\\>\n\nUse the **Ignore chainable methods** option to ignore unused return values from chainable calls.\n\nUse the **Maximal reported method visibility** option to control the maximum visibility of methods to be reported."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UnusedReturnValue",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Declaration redundancy",
"index": 12,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UncheckedExceptionClass",
"shortDescription": {
"text": "Unchecked 'Exception' class"
},
"fullDescription": {
"text": "Reports subclasses of 'java.lang.RuntimeException'. Some coding standards require that all user-defined exception classes are checked. Example: 'class EnigmaException extends RuntimeException {} // warning: Unchecked exception class 'EnigmaException''",
"markdown": "Reports subclasses of `java.lang.RuntimeException`.\n\nSome coding standards require that all user-defined exception classes are checked.\n\n**Example:**\n\n\n class EnigmaException extends RuntimeException {} // warning: Unchecked exception class 'EnigmaException'\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UncheckedExceptionClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SizeReplaceableByIsEmpty",
"shortDescription": {
"text": "'size() == 0' can be replaced with 'isEmpty()'"
},
"fullDescription": {
"text": "Reports '.size()' or '.length()' comparisons with a '0' literal that can be replaced with a call to '.isEmpty()'. Example: 'boolean emptyList = list.size() == 0;' After the quick-fix is applied: 'boolean emptyList = list.isEmpty();' Use the Ignored classes table to add classes for which any '.size()' or '.length()' comparisons should not be replaced. Use the Ignore expressions which would be replaced with '!isEmpty()' option to ignore any expressions which would be replaced with '!isEmpty()'.",
"markdown": "Reports `.size()` or `.length()` comparisons with a `0` literal that can be replaced with a call to `.isEmpty()`.\n\n**Example:**\n\n\n boolean emptyList = list.size() == 0;\n\nAfter the quick-fix is applied:\n\n\n boolean emptyList = list.isEmpty();\n \n\nUse the **Ignored classes** table to add classes for which any `.size()` or `.length()` comparisons should not be replaced.\n\nUse the **Ignore expressions which would be replaced with `!isEmpty()`** option to ignore any expressions which would be replaced with `!isEmpty()`."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SizeReplaceableByIsEmpty",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnsupportedChronoFieldUnitCall",
"shortDescription": {
"text": "Call methods with unsupported 'java.time.temporal.ChronoUnit' and 'java.time.temporal.ChronoField'"
},
"fullDescription": {
"text": "Reports 'java.time' method calls ('get()', 'getLong()', 'with()', 'plus()', 'minus()') with unsupported 'java.time.temporal.ChronoField' or 'java.time.temporal.ChronoUnit' enum constants as arguments. Such calls will throw a 'UnsupportedTemporalTypeException' at runtime. Example: 'LocalTime localTime = LocalTime.now();\nint year = localTime.get(ChronoField.YEAR);' New in 2023.2",
"markdown": "Reports `java.time` method calls (`get()`, `getLong()`, `with()`, `plus()`, `minus()`) with unsupported `java.time.temporal.ChronoField` or `java.time.temporal.ChronoUnit` enum constants as arguments. Such calls will throw a `UnsupportedTemporalTypeException` at runtime.\n\nExample:\n\n\n LocalTime localTime = LocalTime.now();\n int year = localTime.get(ChronoField.YEAR);\n\nNew in 2023.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnsupportedChronoFieldUnitCall",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NumberEquality",
"shortDescription": {
"text": "Number comparison using '==', instead of 'equals()'"
},
"fullDescription": {
"text": "Reports code that uses == or != instead of 'equals()' to test for 'Number' equality. With auto-boxing, it is easy to make the mistake of comparing two instances of a wrapper type instead of two primitives, for example 'Integer' instead of 'int'. Example: 'void foo(Integer a, Integer b) {\n final boolean bool = a == b;\n }' If 'a' is known to be non-null, then it's safe to apply the \"unsafe\" quick-fix and get the result similar to the following: 'void foo(Integer a, Integer b) {\n final boolean bool = a.equals(b);\n }'",
"markdown": "Reports code that uses **==** or **!=** instead of `equals()` to test for `Number` equality.\n\n\nWith auto-boxing, it is easy\nto make the mistake of comparing two instances of a wrapper type instead of two primitives, for example `Integer` instead of\n`int`.\n\n**Example:**\n\n void foo(Integer a, Integer b) {\n final boolean bool = a == b;\n }\n\nIf `a` is known to be non-null, then it's safe to apply the \"unsafe\" quick-fix and get the result similar to the following:\n\n void foo(Integer a, Integer b) {\n final boolean bool = a.equals(b);\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "NumberEquality",
"cweIds": [
480
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ComparatorNotSerializable",
"shortDescription": {
"text": "'Comparator' class not declared 'Serializable'"
},
"fullDescription": {
"text": "Reports classes that implement 'java.lang.Comparator', but do not implement 'java.io.Serializable'. If a non-serializable comparator is used to construct an ordered collection such as a 'java.util.TreeMap' or 'java.util.TreeSet', then the collection will also be non-serializable. This can result in unexpected and difficult-to-diagnose bugs. Since subclasses of 'java.lang.Comparator' are often stateless, simply marking them serializable is a small cost to avoid such issues. Example: 'class Foo implements Comparator { // warning\n @Override\n public int compare(Object o1, Object o2) {\n /* ... */\n }\n }' After the quick-fix is applied: 'class Foo implements Comparator, Serializable { // no warning here\n @Override\n public int compare(Object o1, Object o2) {\n /* ... */\n }\n }'",
"markdown": "Reports classes that implement `java.lang.Comparator`, but do not implement `java.io.Serializable`.\n\n\nIf a non-serializable comparator is used to construct an ordered collection such\nas a `java.util.TreeMap` or `java.util.TreeSet`, then the\ncollection will also be non-serializable. This can result in unexpected and\ndifficult-to-diagnose bugs.\n\n\nSince subclasses of `java.lang.Comparator` are often stateless,\nsimply marking them serializable is a small cost to avoid such issues.\n\n**Example:**\n\n\n class Foo implements Comparator { // warning\n @Override\n public int compare(Object o1, Object o2) {\n /* ... */\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo implements Comparator, Serializable { // no warning here\n @Override\n public int compare(Object o1, Object o2) {\n /* ... */\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ComparatorNotSerializable",
"cweIds": [
502
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Serialization issues",
"index": 20,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassWithOnlyPrivateConstructors",
"shortDescription": {
"text": "Class with only 'private' constructors should be declared 'final'"
},
"fullDescription": {
"text": "Reports classes with only 'private' constructors. A class that only has 'private' constructors cannot be extended outside a file and should be declared as 'final'.",
"markdown": "Reports classes with only `private` constructors.\n\nA class that only has `private` constructors cannot be extended outside a file and should be declared as `final`."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassWithOnlyPrivateConstructors",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UNUSED_IMPORT",
"shortDescription": {
"text": "Unused import"
},
"fullDescription": {
"text": "Reports redundant 'import' statements. Regular 'import' statements are unnecessary when not using imported classes and packages in the source file. The same applies to imported 'static' fields and methods that aren't used in the source file. Example: 'import java.util.ArrayList;\n public class Example {\n public static void main(String[] args) {\n System.out.println(\"Hello World!\");\n }\n }' After the quick fix is applied: 'public class Example {\n public static void main(String[] args) {\n System.out.println(\"Hello World!\");\n }\n }'",
"markdown": "Reports redundant `import` statements.\n\nRegular `import` statements are unnecessary when not using imported classes and packages in the source file.\nThe same applies to imported `static` fields and methods that aren't used in the source file.\n\n**Example:**\n\n\n import java.util.ArrayList;\n public class Example {\n public static void main(String[] args) {\n System.out.println(\"Hello World!\");\n }\n }\n\nAfter the quick fix is applied:\n\n\n public class Example {\n public static void main(String[] args) {\n System.out.println(\"Hello World!\");\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UNUSED_IMPORT",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Imports",
"index": 24,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "FieldAccessedSynchronizedAndUnsynchronized",
"shortDescription": {
"text": "Field accessed in both 'synchronized' and unsynchronized contexts"
},
"fullDescription": {
"text": "Reports non-final fields that are accessed in both 'synchronized' and non-'synchronized' contexts. 'volatile' fields as well as accesses in constructors and initializers are ignored by this inspection. Such \"partially synchronized\" access is often the result of a coding oversight and may lead to unexpectedly inconsistent data structures. Example: 'public class Program {\n Console console; // warning: Field 'console' is accessed in both synchronized and unsynchronized contexts\n\n public synchronized void execute() {\n console.print(\"running\");\n }\n\n public void check() {\n console.check();\n }\n }'\n Use the option to specify if simple getters and setters are counted as accesses too.",
"markdown": "Reports non-final fields that are accessed in both `synchronized` and non-`synchronized` contexts. `volatile` fields as well as accesses in constructors and initializers are ignored by this inspection.\n\n\nSuch \"partially synchronized\" access is often the result of a coding oversight\nand may lead to unexpectedly inconsistent data structures.\n\n**Example:**\n\n\n public class Program {\n Console console; // warning: Field 'console' is accessed in both synchronized and unsynchronized contexts\n\n public synchronized void execute() {\n console.print(\"running\");\n }\n\n public void check() {\n console.check();\n }\n }\n\n\nUse the option to specify if simple getters and setters are counted as accesses too."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "FieldAccessedSynchronizedAndUnsynchronized",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NegatedEqualityExpression",
"shortDescription": {
"text": "Negated equality expression"
},
"fullDescription": {
"text": "Reports equality expressions which are negated by a prefix expression. Such expressions can be simplified using the '!=' operator. Example: '!(i == 1)' After the quick-fix is applied: 'i != 1'",
"markdown": "Reports equality expressions which are negated by a prefix expression.\n\nSuch expressions can be simplified using the `!=` operator.\n\nExample:\n\n\n !(i == 1)\n\nAfter the quick-fix is applied:\n\n\n i != 1\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NegatedEqualityExpression",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RemoveLiteralUnderscores",
"shortDescription": {
"text": "Underscores in numeric literal"
},
"fullDescription": {
"text": "Reports numeric literals with underscores and suggests removing them with a quick-fix. This may be useful if you need to lower the language level. The quick-fix removes underscores from numeric literals. For example '1_000_000' will be converted to '1000000'. Numeric literals with underscores appeared in Java 7. This inspection can help to downgrade for backward compatibility with earlier Java versions. New in 2020.2",
"markdown": "Reports numeric literals with underscores and suggests removing them with a quick-fix. This may be useful if you need to lower the language level.\n\nThe quick-fix removes underscores from numeric literals. For example `1_000_000` will be converted to `1000000`.\n\n\n*Numeric literals with underscores* appeared in Java 7.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions.\n\nNew in 2020.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "RemoveLiteralUnderscores",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MathRandomCastToInt",
"shortDescription": {
"text": "'Math.random()' cast to 'int'"
},
"fullDescription": {
"text": "Reports calls to 'Math.random()' which are immediately cast to 'int'. Casting a 'double' between '0.0' (inclusive) and '1.0' (exclusive) to 'int' will always round down to zero. The value should first be multiplied by some factor before casting it to an 'int' to get a value between zero (inclusive) and the multiplication factor (exclusive). Another possible solution is to use the 'nextInt()' method of 'java.util.Random'. Example: 'int r = (int)Math.random() * 10;' After the quick fix is applied: 'int r = (int)(Math.random() * 10);'",
"markdown": "Reports calls to `Math.random()` which are immediately cast to `int`.\n\nCasting a `double` between `0.0` (inclusive) and\n`1.0` (exclusive) to `int` will always round down to zero. The value\nshould first be multiplied by some factor before casting it to an `int` to\nget a value between zero (inclusive) and the multiplication factor (exclusive).\nAnother possible solution is to use the `nextInt()` method of\n`java.util.Random`.\n\n**Example:**\n\n int r = (int)Math.random() * 10;\n\nAfter the quick fix is applied:\n\n int r = (int)(Math.random() * 10);\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "MathRandomCastToInt",
"cweIds": [
330,
681
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "DoubleBraceInitialization",
"shortDescription": {
"text": "Double brace initialization"
},
"fullDescription": {
"text": "Reports Double Brace Initialization. Double brace initialization may cause memory leaks when used in a non-static context because it creates an anonymous class that will reference the surrounding object. Compared to regular initialization, double brace initialization provides worse performance since it requires loading an additional class. It may also cause failure of 'equals()' comparisons if the 'equals()' method doesn't accept subclasses as parameters. In addition, before Java 9, double brace initialization couldn't be combined with the diamond operator since it was incompatible with anonymous classes. Example: 'List<Integer> list = new ArrayList<>() {{\n add(1);\n add(2);\n }};' After the quick-fix is applied: 'List<Integer> list = new ArrayList<>();\n list.add(1);\n list.add(2);'",
"markdown": "Reports [Double Brace Initialization](https://www.c2.com/cgi/wiki?DoubleBraceInitialization).\n\nDouble brace initialization may cause memory leaks when used in a non-static context because it creates an anonymous class\nthat will reference the surrounding object.\n\nCompared to regular initialization, double brace initialization provides worse performance since it requires loading an\nadditional class.\n\nIt may also cause failure of `equals()` comparisons if the `equals()` method doesn't accept subclasses as\nparameters.\n\nIn addition, before Java 9, double brace initialization couldn't be combined with the diamond operator since it was incompatible\nwith anonymous classes.\n\n**Example:**\n\n\n List<Integer> list = new ArrayList<>() {{\n add(1);\n add(2);\n }};\n\nAfter the quick-fix is applied:\n\n\n List<Integer> list = new ArrayList<>();\n list.add(1);\n list.add(2);\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "DoubleBraceInitialization",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Initialization",
"index": 33,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StringConcatenationInLoops",
"shortDescription": {
"text": "String concatenation in loop"
},
"fullDescription": {
"text": "Reports String concatenation in loops. As every String concatenation copies the whole string, usually it is preferable to replace it with explicit calls to 'StringBuilder.append()' or 'StringBuffer.append()'. Example: 'String str = \"\";\n for(int i=0; i<10; i++) {\n str += i;\n }' After the quick-fix is applied: 'String str = \"\";\n StringBuilder strBuilder = new StringBuilder(str);\n for(int i = 0; i<10; i++) {\n strBuilder.append(i);\n }\n str = strBuilder.toString();' Sometimes, the quick-fixes allow you to convert a 'String' variable to a 'StringBuilder' or introduce a new 'StringBuilder'. Be careful if the original code specially handles the 'null' value, as the replacement may change semantics. If 'null' is possible, null-safe fixes that generate necessary null-checks are suggested. Also, it's not guaranteed that the automatic replacement will always be more performant.",
"markdown": "Reports String concatenation in loops.\n\n\nAs every String concatenation copies the whole\nstring, usually it is preferable to replace it with explicit calls to `StringBuilder.append()` or\n`StringBuffer.append()`.\n\n**Example:**\n\n\n String str = \"\";\n for(int i=0; i<10; i++) {\n str += i;\n }\n\nAfter the quick-fix is applied:\n\n\n String str = \"\";\n StringBuilder strBuilder = new StringBuilder(str);\n for(int i = 0; i<10; i++) {\n strBuilder.append(i);\n }\n str = strBuilder.toString();\n\n\nSometimes, the quick-fixes allow you to convert a `String` variable to a `StringBuilder` or\nintroduce a new `StringBuilder`. Be careful if the original code specially handles the `null` value, as the\nreplacement may change semantics. If `null` is possible, null-safe fixes that generate\nnecessary null-checks are suggested. Also, it's not guaranteed that the automatic replacement will always be more performant."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "StringConcatenationInLoop",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CloneableClassInSecureContext",
"shortDescription": {
"text": "Cloneable class in secure context"
},
"fullDescription": {
"text": "Reports classes which may be cloned. A class may be cloned if it supports the 'Cloneable' interface, and its 'clone()' method is not defined to immediately throw an error. Cloneable classes may be dangerous in code intended for secure use. Example: 'class SecureBean implements Cloneable {}' After the quick-fix is applied: 'class SecureBean {}' When the class extends an existing cloneable class or implements a cloneable interface, then after the quick-fix is applied, the code may look like: 'class SecureBean extends ParentBean {\n @Override\n protected SecureBean clone() throws CloneNotSupportedException {\n throw new CloneNotSupportedException();\n }\n}'",
"markdown": "Reports classes which may be cloned.\n\n\nA class\nmay be cloned if it supports the `Cloneable` interface,\nand its `clone()` method is not defined to immediately\nthrow an error. Cloneable classes may be dangerous in code intended for secure use.\n\n**Example:**\n`class SecureBean implements Cloneable {}`\n\nAfter the quick-fix is applied:\n`class SecureBean {}`\n\n\nWhen the class extends an existing cloneable class or implements a cloneable interface,\nthen after the quick-fix is applied, the code may look like:\n\n class SecureBean extends ParentBean {\n @Override\n protected SecureBean clone() throws CloneNotSupportedException {\n throw new CloneNotSupportedException();\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CloneableClassInSecureContext",
"cweIds": [
498
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Security",
"index": 38,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InconsistentTextBlockIndent",
"shortDescription": {
"text": "Inconsistent whitespace indentation in text block"
},
"fullDescription": {
"text": "Reports text blocks that are indented using both spaces and tabs. Such cases produce unexpected results since spaces and tabs are treated equally by the text block processing. In the following example, spaces and tabs are visualized as '·' and '␉' respectively, and a tab is equal to 4 spaces in the editor. Example: 'String colors = \"\"\"\n········red\n␉ ␉ green\n········blue\"\"\";' After printing such a string, the result will be: '······red\ngreen\n······blue' After the compiler removes an equal amount of spaces or tabs from the beginning of each line, some lines remain with leading spaces. This inspection only reports if the configured language level is 15 or higher. New in 2021.1",
"markdown": "Reports text blocks that are indented using both spaces and tabs. Such cases produce unexpected results since spaces and tabs are treated equally by the text block processing.\n\nIn the following example, spaces and tabs are visualized as `·` and `␉` respectively,\nand a tab is equal to 4 spaces in the editor.\n\n**Example:**\n\n\n String colors = \"\"\"\n ········red\n ␉ ␉ green\n ········blue\"\"\";\n\nAfter printing such a string, the result will be:\n\n\n ······red\n green\n ······blue\n\nAfter the compiler removes an equal amount of spaces or tabs from the beginning of each line,\nsome lines remain with leading spaces.\n\nThis inspection only reports if the configured language level is 15 or higher.\n\nNew in 2021.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "InconsistentTextBlockIndent",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AssertionCanBeIf",
"shortDescription": {
"text": "Assertion can be replaced with 'if' statement"
},
"fullDescription": {
"text": "Reports 'assert' statements and suggests replacing them with 'if' statements that throw 'java.lang.AssertionError'. Example: 'assert param != null;' After the quick-fix is applied: 'if (param == null) throw new AssertionError();'",
"markdown": "Reports `assert` statements and suggests replacing them with `if` statements that throw `java.lang.AssertionError`.\n\nExample:\n\n\n assert param != null;\n\nAfter the quick-fix is applied:\n\n\n if (param == null) throw new AssertionError();\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "AssertionCanBeIf",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "DoubleNegation",
"shortDescription": {
"text": "Double negation"
},
"fullDescription": {
"text": "Reports double negations that can be simplified. Example: 'if (!!functionCall()) {}' After the quick-fix is applied: 'if (functionCall()) {}' Example: 'if (!(a != b)) {}' After the quick-fix is applied: 'if (a == b) {}'",
"markdown": "Reports double negations that can be simplified.\n\nExample:\n\n\n if (!!functionCall()) {}\n\nAfter the quick-fix is applied:\n\n\n if (functionCall()) {}\n\nExample:\n\n\n if (!(a != b)) {}\n\nAfter the quick-fix is applied:\n\n\n if (a == b) {}\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "DoubleNegation",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PackageWithTooFewClasses",
"shortDescription": {
"text": "Package with too few classes"
},
"fullDescription": {
"text": "Reports packages that contain fewer classes than the specified minimum. Packages which contain subpackages are not reported. Overly small packages may indicate a fragmented design. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor. Use the Minimum number of classes field to specify the minimum allowed number of classes in a package.",
"markdown": "Reports packages that contain fewer classes than the specified minimum.\n\nPackages which contain subpackages are not reported. Overly small packages may indicate a fragmented design.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor.\n\nUse the **Minimum number of classes** field to specify the minimum allowed number of classes in a package."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "PackageWithTooFewClasses",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Packaging issues",
"index": 44,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ReplaceOnLiteralHasNoEffect",
"shortDescription": {
"text": "Replacement operation has no effect"
},
"fullDescription": {
"text": "Reports calls to the 'String' methods 'replace()', 'replaceAll()' or 'replaceFirst()' that have no effect. Such calls can be guaranteed to have no effect when the qualifier and search string are compile-time constants and the search string is not found in the qualifier. This is redundant and may indicate an error. Example: '// replacement does nothing\n \"hello\".replace(\"$value$\", value);' New in 2022.1",
"markdown": "Reports calls to the `String` methods `replace()`, `replaceAll()` or `replaceFirst()` that have no effect. Such calls can be guaranteed to have no effect when the qualifier and search string are compile-time constants and the search string is not found in the qualifier. This is redundant and may indicate an error.\n\n**Example:**\n\n\n // replacement does nothing\n \"hello\".replace(\"$value$\", value);\n\nNew in 2022.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ReplaceOnLiteralHasNoEffect",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SingleClassImport",
"shortDescription": {
"text": "Single class import"
},
"fullDescription": {
"text": "Reports 'import' statements that import single classes (as opposed to entire packages). Some coding standards prohibit such 'import' statements. You can configure IntelliJ IDEA to detect and fix such statements with its Optimize Imports command. Go to Settings | Editor | Code Style | Java | Imports and clear the Use single class import checkbox. Thus this inspection is mostly useful for offline reporting on code bases that you don't intend to change.",
"markdown": "Reports `import` statements that import single classes (as opposed to entire packages).\n\nSome coding standards prohibit such `import` statements.\n\n\nYou can configure IntelliJ IDEA to detect and fix such statements with its **Optimize Imports** command. Go to\n[Settings \\| Editor \\| Code Style \\| Java \\| Imports](settings://preferences.sourceCode.Java?Use%20single%20class%20import)\nand clear the **Use single class import** checkbox. Thus this inspection is mostly useful for\noffline reporting on code bases that you don't intend to change."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SingleClassImport",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Imports",
"index": 24,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "BadOddness",
"shortDescription": {
"text": "Suspicious oddness check"
},
"fullDescription": {
"text": "Reports odd-even checks of the following form: 'x % 2 == 1'. Such checks fail when used with negative odd values. Consider using 'x % 2 != 0' or '(x & 1) == 1' instead.",
"markdown": "Reports odd-even checks of the following form: `x % 2 == 1`. Such checks fail when used with negative odd values. Consider using `x % 2 != 0` or `(x & 1) == 1` instead."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "BadOddness",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LoggingConditionDisagreesWithLogLevelStatement",
"shortDescription": {
"text": "Log condition does not match logging call"
},
"fullDescription": {
"text": "Reports is log enabled for conditions of 'if' statements that do not match the log level of the contained logging call. For example: 'if (LOG.isTraceEnabled()) {\n // debug level logged, but checked for trace level\n LOG.debug(\"some log message\");\n }' This inspection understands the java.util.logging, Log4j, Log4j2, Apache Commons Logging and the SLF4J logging frameworks.",
"markdown": "Reports *is log enabled for* conditions of `if` statements that do not match the log level of the contained logging call.\n\n\nFor example:\n\n\n if (LOG.isTraceEnabled()) {\n // debug level logged, but checked for trace level\n LOG.debug(\"some log message\");\n }\n\nThis inspection understands the *java.util.logging* , *Log4j* , *Log4j2* , *Apache Commons Logging*\nand the *SLF4J* logging frameworks."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "LoggingConditionDisagreesWithLogLevelStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Logging",
"index": 52,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SystemOutErr",
"shortDescription": {
"text": "Use of 'System.out' or 'System.err'"
},
"fullDescription": {
"text": "Reports usages of 'System.out' or 'System.err'. Such statements are often used for temporary debugging and should be either removed from the production code, or replaced by a more robust logging facility.",
"markdown": "Reports usages of `System.out` or `System.err`.\n\nSuch statements are often used for temporary debugging and should be either removed from the production code, or replaced by a more robust\nlogging facility."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UseOfSystemOutOrSystemErr",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code maturity",
"index": 56,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CheckedExceptionClass",
"shortDescription": {
"text": "Checked exception class"
},
"fullDescription": {
"text": "Reports checked exception classes (that is, subclasses of 'java.lang.Exception' that are not subclasses of 'java.lang.RuntimeException'). Some coding standards suppress checked user-defined exception classes. Example: 'class IllegalMoveException extends Exception {}'",
"markdown": "Reports checked exception classes (that is, subclasses of `java.lang.Exception` that are not subclasses of `java.lang.RuntimeException`).\n\nSome coding standards suppress checked user-defined exception classes.\n\n**Example:**\n\n\n class IllegalMoveException extends Exception {}\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CheckedExceptionClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SerializableStoresNonSerializable",
"shortDescription": {
"text": "'Serializable' object implicitly stores non-'Serializable' object"
},
"fullDescription": {
"text": "Reports any references to local non-'Serializable' variables outside 'Serializable' lambdas, local and anonymous classes. When a local variable is referenced from an anonymous class, its value is stored in an implicit field of that class. The same happens for local classes and lambdas. If the variable is of a non-'Serializable' type, serialization will fail. Example: 'interface A extends Serializable {\n abstract void foo();\n }\n class B {}\n class C {\n void foo() {\n B b = new B();\n A a = new A() {\n @Override\n public void foo() {\n System.out.println(b); // warning\n }\n };\n }\n }'",
"markdown": "Reports any references to local non-`Serializable` variables outside `Serializable` lambdas, local and anonymous classes.\n\n\nWhen a local variable is referenced from an anonymous class, its value\nis stored in an implicit field of that class. The same happens\nfor local classes and lambdas. If the variable is of a\nnon-`Serializable` type, serialization will fail.\n\n**Example:**\n\n\n interface A extends Serializable {\n abstract void foo();\n }\n class B {}\n class C {\n void foo() {\n B b = new B();\n A a = new A() {\n @Override\n public void foo() {\n System.out.println(b); // warning\n }\n };\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SerializableStoresNonSerializable",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Serialization issues",
"index": 20,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InsertLiteralUnderscores",
"shortDescription": {
"text": "Unreadable numeric literal"
},
"fullDescription": {
"text": "Reports long numeric literals without underscores and suggests adding them. Underscores make such literals easier to read. Example: '1000000' After the quick-fix is applied: '1_000_000' This inspection only reports if the language level of the project of module is 7 or higher. New in 2020.2",
"markdown": "Reports long numeric literals without underscores and suggests adding them. Underscores make such literals easier to read.\n\nExample:\n\n\n 1000000\n\nAfter the quick-fix is applied:\n\n\n 1_000_000\n\nThis inspection only reports if the language level of the project of module is 7 or higher.\n\nNew in 2020.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "InsertLiteralUnderscores",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "BreakStatement",
"shortDescription": {
"text": "'break' statement"
},
"fullDescription": {
"text": "Reports 'break' statements that are used in places other than at the end of a 'switch' statement branch. 'break' statements complicate refactoring and can be confusing. Example: 'void foo(List<String> strs) {\n for (String str : strs) {\n if (str.contains(\"stop\")) break;\n handleStr(str);\n }\n}'",
"markdown": "Reports `break` statements that are used in places other than at the end of a `switch` statement branch.\n\n`break` statements complicate refactoring and can be confusing.\n\nExample:\n\n\n void foo(List<String> strs) {\n for (String str : strs) {\n if (str.contains(\"stop\")) break;\n handleStr(str);\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "BreakStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JDBCExecuteWithNonConstantString",
"shortDescription": {
"text": "Call to 'Statement.execute()' with non-constant string"
},
"fullDescription": {
"text": "Reports calls to 'java.sql.Statement.execute()' or any of its variants which take a dynamically-constructed string as the query to execute. Constructed SQL statements are a common source of security breaches. By default, this inspection ignores compile-time constants. Example: 'ResultSet execute(Statement statement, String name) throws SQLException {\n return statement.executeQuery(\"select * from \" + name); // reports warning\n }' Use the inspection options to consider any 'static' 'final' fields as constant. Be careful, because strings like the following will be ignored when the option is enabled: 'private static final String SQL = \"SELECT * FROM user WHERE name='\" + getUserInput() + \"'\";'",
"markdown": "Reports calls to `java.sql.Statement.execute()` or any of its variants which take a dynamically-constructed string as the query to execute.\n\nConstructed SQL statements are a common source of security breaches.\nBy default, this inspection ignores compile-time constants.\n\n**Example:**\n\n\n ResultSet execute(Statement statement, String name) throws SQLException {\n return statement.executeQuery(\"select * from \" + name); // reports warning\n }\n\n\nUse the inspection options to consider any `static` `final` fields as constant.\nBe careful, because strings like the following will be ignored when the option is enabled:\n\n\n private static final String SQL = \"SELECT * FROM user WHERE name='\" + getUserInput() + \"'\";\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "JDBCExecuteWithNonConstantString",
"cweIds": [
89,
564
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Security",
"index": 38,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ConstantValueVariableUse",
"shortDescription": {
"text": "Use of variable whose value is known to be constant"
},
"fullDescription": {
"text": "Reports any usages of variables which are known to be constant. This is the case if the (read) use of the variable is surrounded by an 'if', 'while', or 'for' statement with an '==' condition which compares the variable with a constant. In this case, the use of a variable which is known to be constant can be replaced with an actual constant. Example: 'private static void foo(double number) {\n if (number == 1.0) {\n f(number);\n }\n }\n private static void f(double number) {}' After the quick-fix is applied: 'private static void foo(double number) {\n if (number == 1.0) {\n f(1.0);\n }\n }\n private static void f(double number) {}'",
"markdown": "Reports any usages of variables which are known to be constant.\n\nThis is the case if the (read) use of the variable is surrounded by an\n`if`, `while`, or `for`\nstatement with an `==` condition which compares the variable with a constant.\nIn this case, the use of a variable which is known to be constant can be replaced with\nan actual constant.\n\nExample:\n\n\n private static void foo(double number) {\n if (number == 1.0) {\n f(number);\n }\n }\n private static void f(double number) {}\n\nAfter the quick-fix is applied:\n\n\n private static void foo(double number) {\n if (number == 1.0) {\n f(1.0);\n }\n }\n private static void f(double number) {}\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ConstantValueVariableUse",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Data flow",
"index": 65,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NewStringBufferWithCharArgument",
"shortDescription": {
"text": "StringBuilder constructor call with 'char' argument"
},
"fullDescription": {
"text": "Reports calls to 'StringBuffer' and 'StringBuilder' constructors with 'char' as the argument. In this case, 'char' is silently cast to an integer and interpreted as the initial capacity of the buffer. Example: 'new StringBuilder('(').append(\"1\").append(')');' After the quick-fix is applied: 'new StringBuilder(\"(\").append(\"1\").append(')');'",
"markdown": "Reports calls to `StringBuffer` and `StringBuilder` constructors with `char` as the argument. In this case, `char` is silently cast to an integer and interpreted as the initial capacity of the buffer.\n\n**Example:**\n\n\n new StringBuilder('(').append(\"1\").append(')');\n\nAfter the quick-fix is applied:\n\n\n new StringBuilder(\"(\").append(\"1\").append(')');\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "NewStringBufferWithCharArgument",
"cweIds": [
628,
704
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassGetClass",
"shortDescription": {
"text": "Suspicious 'Class.getClass()' call"
},
"fullDescription": {
"text": "Reports 'getClass()' methods that are called on a 'java.lang.Class' instance. This is usually a mistake as the result is always equivalent to 'Class.class'. If it's a mistake, then it's better to remove the 'getClass()' call and use the qualifier directly. If the behavior is intended, then it's better to write 'Class.class' explicitly to avoid confusion. Example: 'void test(Class<?> clazz) {\n String name = clazz.getClass().getName();\n }' After one of the possible quick-fixes is applied: 'void test(Class<?> clazz) {\n String name = clazz.getName();\n }' New in 2018.2",
"markdown": "Reports `getClass()` methods that are called on a `java.lang.Class` instance.\n\nThis is usually a mistake as the result is always equivalent to `Class.class`.\nIf it's a mistake, then it's better to remove the `getClass()` call and use the qualifier directly.\nIf the behavior is intended, then it's better to write `Class.class` explicitly to avoid confusion.\n\nExample:\n\n\n void test(Class<?> clazz) {\n String name = clazz.getClass().getName();\n }\n\nAfter one of the possible quick-fixes is applied:\n\n\n void test(Class<?> clazz) {\n String name = clazz.getName();\n }\n\nNew in 2018.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ClassGetClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ResultOfObjectAllocationIgnored",
"shortDescription": {
"text": "Result of object allocation ignored"
},
"fullDescription": {
"text": "Reports object allocations where the allocated object is ignored and neither assigned to a variable nor used in another way. Such allocation expressions are legal in Java, but are usually either unintended, or evidence of a very odd object initialization strategy. Use the options to list classes whose allocations should be ignored by this inspection.",
"markdown": "Reports object allocations where the allocated object is ignored and neither assigned to a variable nor used in another way.\n\n\nSuch allocation expressions are legal in Java, but are usually either unintended, or\nevidence of a very odd object initialization strategy.\n\n\nUse the options to list classes whose allocations should be ignored by this inspection."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ResultOfObjectAllocationIgnored",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnusedLibrary",
"shortDescription": {
"text": "Unused library"
},
"fullDescription": {
"text": "Reports libraries attached to the specified inspection scope that are not used directly in code.",
"markdown": "Reports libraries attached to the specified inspection scope that are not used directly in code."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UnusedLibrary",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Declaration redundancy",
"index": 12,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ObsoleteCollection",
"shortDescription": {
"text": "Use of obsolete collection type"
},
"fullDescription": {
"text": "Reports usages of 'java.util.Vector', 'java.util.Hashtable' and 'java.util.Stack'. Usages of these classes can often be replaced with usages of 'java.util.ArrayList', 'java.util.HashMap' and 'java.util.ArrayDeque' respectively. While still supported, the former classes were made obsolete by the JDK1.2 collection classes, and should probably not be used in new development. Use the Ignore obsolete collection types where they are required option to ignore any cases where the obsolete collections are used as method arguments or assigned to a variable that requires the obsolete type. Enabling this option may consume significant processor resources.",
"markdown": "Reports usages of `java.util.Vector`, `java.util.Hashtable` and `java.util.Stack`.\n\nUsages of these classes can often be replaced with usages of\n`java.util.ArrayList`, `java.util.HashMap` and `java.util.ArrayDeque` respectively.\nWhile still supported,\nthe former classes were made obsolete by the JDK1.2 collection classes, and should probably\nnot be used in new development.\n\n\nUse the **Ignore obsolete collection types where they are required** option to ignore any cases where the obsolete collections are used\nas method arguments or assigned to a variable that requires the obsolete type.\nEnabling this option may consume significant processor resources."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UseOfObsoleteCollectionType",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code maturity",
"index": 56,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ForEachWithRecordPatternCanBeUsed",
"shortDescription": {
"text": "Enhanced 'for' with a record pattern can be used"
},
"fullDescription": {
"text": "Reports local variable declarations and accessors to record components that can be replaced with pattern variables in enhanced `for` statements, which are usually more compact. Example: 'record Record(Integer x, String y) {\n}\n\npublic static void test(List<Record> records) {\n for (Record record : records) {\n System.out.println(record.y());\n Integer x = record.x;\n System.out.println(x);\n }\n}' Can be replaced with: 'record Record(Integer x, String y) {\n}\n\npublic static void test(List<Record> records) {\n for (Record(Integer x, String y) : records) {\n System.out.println(y);\n System.out.println(x);\n }\n}' This inspection only reports if the language level of the project or module is 20 or higher Use the Nesting depth limit option to specify the maximum number of nested deconstruction patterns to report Use the Maximum number of record components to deconstruct option to specify the maximum number of components, which a record can contain to be used in deconstruction patterns Use the Maximum number of not-used record components option to specify the maximum number of components, which are not used in 'for' statement New in 2023.1",
"markdown": "Reports local variable declarations and accessors to record components that can be replaced with pattern variables in enhanced \\`for\\` statements, which are usually more compact.\n\n**Example:**\n\n\n record Record(Integer x, String y) {\n }\n\n public static void test(List<Record> records) {\n for (Record record : records) {\n System.out.println(record.y());\n Integer x = record.x;\n System.out.println(x);\n }\n }\n\nCan be replaced with:\n\n\n record Record(Integer x, String y) {\n }\n\n public static void test(List<Record> records) {\n for (Record(Integer x, String y) : records) {\n System.out.println(y);\n System.out.println(x);\n }\n }\n\nThis inspection only reports if the language level of the project or module is 20 or higher\n\n* Use the **Nesting depth limit** option to specify the maximum number of nested deconstruction patterns to report\n* Use the **Maximum number of record components to deconstruct** option to specify the maximum number of components, which a record can contain to be used in deconstruction patterns\n* Use the **Maximum number of not-used record components** option to specify the maximum number of components, which are not used in `for` statement\n\nNew in 2023.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ForEachWithRecordPatternCanBeUsed",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 20",
"index": 71,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MismatchedStringBuilderQueryUpdate",
"shortDescription": {
"text": "Mismatched query and update of 'StringBuilder'"
},
"fullDescription": {
"text": "Reports 'StringBuilder', 'StringBuffer' or 'StringJoiner' objects whose contents are read but not written to, or written to but not read. Such inconsistent reads and writes are pointless and probably indicate dead, incomplete, or erroneous code. Example: 'public void m1() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"a\");\n }'",
"markdown": "Reports `StringBuilder`, `StringBuffer` or `StringJoiner` objects whose contents are read but not written to, or written to but not read.\n\nSuch inconsistent reads and writes are pointless and probably indicate\ndead, incomplete, or erroneous code.\n\n**Example:**\n\n\n public void m1() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"a\");\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "MismatchedQueryAndUpdateOfStringBuilder",
"cweIds": [
561,
563
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "FinalizeNotProtected",
"shortDescription": {
"text": "'finalize()' should be protected, not public"
},
"fullDescription": {
"text": "Reports any implementations of the 'Object.finalize()' method that are declared 'public'. According to the contract of the 'Object.finalize()', only the garbage collector calls this method. Making this method public may be confusing, because it means that the method can be used from other code. A quick-fix is provided to make the method 'protected', to prevent it from being invoked from other classes. Example: 'class X {\n public void finalize() {\n /* ... */\n }\n }' After the quick-fix is applied: 'class X {\n protected void finalize() {\n /* ... */\n }\n }'",
"markdown": "Reports any implementations of the `Object.finalize()` method that are declared `public`.\n\n\nAccording to the contract of the `Object.finalize()`, only the garbage\ncollector calls this method. Making this method public may be confusing, because it\nmeans that the method can be used from other code.\n\n\nA quick-fix is provided to make the method `protected`, to prevent it from being invoked\nfrom other classes.\n\n**Example:**\n\n\n class X {\n public void finalize() {\n /* ... */\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n protected void finalize() {\n /* ... */\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "FinalizeNotProtected",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Finalization",
"index": 76,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LogStatementGuardedByLogCondition",
"shortDescription": {
"text": "Logging call not guarded by log condition"
},
"fullDescription": {
"text": "Reports logging calls with non-constant arguments that are not surrounded by a guard condition. The evaluation of the arguments of a logging call can be expensive. Surrounding a logging call with a guard clause prevents that cost when logging is disabled for the level used by the logging statement. This is especially useful for the least serious level (trace, debug, finest) of logging calls, because those are most often disabled in a production environment. Example: 'public class Principal {\n void bad(Object object) {\n if (true) {\n LOG.debug(\"log log log \" + expensiveCalculation(object));\n }\n LOG.debug(\"some more logging \" + expensiveCalculation(1));\n }\n\n void good(Object) {\n if (LOG.isDebug()) {\n LOG.debug(\"value: \" + expensiveCalculation(object));\n }\n }\n }' Configure the inspection: Use the Logger class name field to specify the logger class name used. Use the table to specify the logging methods this inspection should warn on, with the corresponding log condition text. Use the Flag all unguarded logging calls option to have the inspection flag all unguarded log calls, not only those with non-constant arguments.",
"markdown": "Reports logging calls with non-constant arguments that are not surrounded by a guard condition. The evaluation of the arguments of a logging call can be expensive. Surrounding a logging call with a guard clause prevents that cost when logging is disabled for the level used by the logging statement. This is especially useful for the least serious level (trace, debug, finest) of logging calls, because those are most often disabled in a production environment.\n\n**Example:**\n\n\n public class Principal {\n void bad(Object object) {\n if (true) {\n LOG.debug(\"log log log \" + expensiveCalculation(object));\n }\n LOG.debug(\"some more logging \" + expensiveCalculation(1));\n }\n\n void good(Object) {\n if (LOG.isDebug()) {\n LOG.debug(\"value: \" + expensiveCalculation(object));\n }\n }\n }\n\n\nConfigure the inspection:\n\n* Use the **Logger class name** field to specify the logger class name used.\n*\n Use the table to specify the logging methods this inspection should warn on, with the corresponding log condition text.\n\n* Use the **Flag all unguarded logging calls** option to have the inspection flag all unguarded log calls, not only those with non-constant arguments."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "LogStatementGuardedByLogCondition",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Logging",
"index": 77,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ModuleWithTooManyClasses",
"shortDescription": {
"text": "Module with too many classes"
},
"fullDescription": {
"text": "Reports modules that contain too many classes. Overly large modules may indicate a lack of design clarity. Java, Kotlin and Groovy classes are counted. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor. Use the Maximum number of classes field to specify the maximum number of classes a module may have.",
"markdown": "Reports modules that contain too many classes. Overly large modules may indicate a lack of design clarity. Java, Kotlin and Groovy classes are counted.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor.\n\nUse the **Maximum number of classes** field to specify the maximum number of classes a module may have."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ModuleWithTooManyClasses",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Modularization issues",
"index": 78,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InfiniteLoopStatement",
"shortDescription": {
"text": "Infinite loop statement"
},
"fullDescription": {
"text": "Reports 'for', 'while', or 'do' statements that can only exit by throwing an exception. While such statements may be correct, they often happen due to coding errors. Example: 'for (;;) {\n }' Use the Ignore when placed in Thread.run option to ignore the infinite loop statements inside 'Thread.run'. It may be useful for the daemon threads. Example: 'new Thread(() -> {\n while (true) {\n }\n }).start();'",
"markdown": "Reports `for`, `while`, or `do` statements that can only exit by throwing an exception. While such statements may be correct, they often happen due to coding errors.\n\nExample:\n\n\n for (;;) {\n }\n\n\nUse the **Ignore when placed in Thread.run** option to ignore the\ninfinite loop statements inside `Thread.run`.\nIt may be useful for the daemon threads.\n\nExample:\n\n\n new Thread(() -> {\n while (true) {\n }\n }).start();\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "InfiniteLoopStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavadocHtmlLint",
"shortDescription": {
"text": "HTML problems in Javadoc (DocLint)"
},
"fullDescription": {
"text": "Reports the same HTML issues in the Javadoc comments that have been reported by DocLint since Java 8. The inspection detects the following issues: Self-closed, unclosed, unknown, misplaced, or empty tag Unknown or wrong attribute Misplaced text Example: '/**\n * Unknown tag: List<String>\n * Unclosed tag: error</b>\n * Misplaced text or tag: <ul><li>one</li>, <li>two</li></ul>\n * Wrong or empty attribute: <a href=\"\"></a>\n * Self-closed tag: <br/>\n * ...\n */\nvoid sample(){ }'",
"markdown": "Reports the same HTML issues in the Javadoc comments that have been reported by DocLint since Java 8.\n\nThe inspection detects the following issues:\n\n* Self-closed, unclosed, unknown, misplaced, or empty tag\n* Unknown or wrong attribute\n* Misplaced text\n\nExample:\n\n\n /**\n * Unknown tag: List<String>\n * Unclosed tag: error</b>\n * Misplaced text or tag: <ul><li>one</li>, <li>two</li></ul>\n * Wrong or empty attribute: <a href=\"\"></a>\n * Self-closed tag: <br/>\n * ...\n */\n void sample(){ }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "error",
"parameters": {
"suppressToolId": "JavadocHtmlLint",
"ideaSeverity": "ERROR",
"qodanaSeverity": "Critical"
}
},
"relationships": [
{
"target": {
"id": "Java/Javadoc",
"index": 79,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassUnconnectedToPackage",
"shortDescription": {
"text": "Class independent of its package"
},
"fullDescription": {
"text": "Reports classes that don't depend on any other class in their package and are not a dependency for any other class in their package. Such classes indicate ad-hoc or incoherent packaging strategies and often may be profitably moved. Classes that are the only class in their package are not reported. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.",
"markdown": "Reports classes that don't depend on any other class in their package and are not a dependency for any other class in their package. Such classes indicate ad-hoc or incoherent packaging strategies and often may be profitably moved. Classes that are the only class in their package are not reported.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassUnconnectedToPackage",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Packaging issues",
"index": 44,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ExceptionNameDoesntEndWithException",
"shortDescription": {
"text": "Exception class name does not end with 'Exception'"
},
"fullDescription": {
"text": "Reports exception classes whose names don't end with 'Exception'. Example: 'class NotStartedEx extends Exception {}' A quick-fix that renames such classes is available only in the editor.",
"markdown": "Reports exception classes whose names don't end with `Exception`.\n\n**Example:** `class NotStartedEx extends Exception {}`\n\nA quick-fix that renames such classes is available only in the editor."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ExceptionClassNameDoesntEndWithException",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Naming conventions/Class",
"index": 82,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NonFinalStaticVariableUsedInClassInitialization",
"shortDescription": {
"text": "Non-final static field is used during class initialization"
},
"fullDescription": {
"text": "Reports the use of non-'final' 'static' variables during class initialization. In such cases, the code semantics may become dependent on the class creation order. Additionally, such cases may lead to the use of variables before their initialization, and generally cause difficult and confusing bugs. Example: 'class Foo {\n public static int bar = 0;\n\n static {\n System.out.println(bar);\n }\n }'",
"markdown": "Reports the use of non-`final` `static` variables during class initialization.\n\nIn such cases, the code semantics may become dependent on the class creation order. Additionally, such cases may lead to the use of\nvariables before their initialization, and generally cause difficult and confusing bugs.\n\n**Example:**\n\n\n class Foo {\n public static int bar = 0;\n\n static {\n System.out.println(bar);\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonFinalStaticVariableUsedInClassInitialization",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Initialization",
"index": 33,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ThreadStopSuspendResume",
"shortDescription": {
"text": "Call to 'Thread.stop()', 'suspend()' or 'resume()'"
},
"fullDescription": {
"text": "Reports calls to 'Thread.stop()', 'Thread.suspend()', and 'Thread.resume()'. These calls are inherently prone to data corruption and deadlocks, and their use is strongly discouraged. It is better to use cooperative cancellation instead of 'stop', and interruption instead of direct calls to 'suspend' and 'resume'.",
"markdown": "Reports calls to `Thread.stop()`, `Thread.suspend()`, and `Thread.resume()`.\n\n\nThese calls are inherently prone to data corruption and deadlocks, and their use is strongly discouraged.\nIt is better to use cooperative cancellation instead of `stop`, and\ninterruption instead of direct calls to `suspend` and `resume`."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CallToThreadStopSuspendOrResumeManager",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryTemporaryOnConversionFromString",
"shortDescription": {
"text": "Unnecessary temporary object in conversion from 'String'"
},
"fullDescription": {
"text": "Reports unnecessary creation of temporary objects when converting from 'String' to primitive types. Example: 'new Integer(\"3\").intValue()' After the quick-fix is applied: 'Integer.valueOf(\"3\")'",
"markdown": "Reports unnecessary creation of temporary objects when converting from `String` to primitive types.\n\n**Example:**\n\n\n new Integer(\"3\").intValue()\n\nAfter the quick-fix is applied:\n\n\n Integer.valueOf(\"3\")\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryTemporaryOnConversionFromString",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UseOfConcreteClass",
"shortDescription": {
"text": "Use of concrete class"
},
"fullDescription": {
"text": "Reports usages of concrete classes, rather than interfaces. Such declarations may represent a failure of abstraction and may make testing more difficult. Declarations whose classes come from system or third-party libraries will not be reported by this inspection. Casts, instanceofs, and local variables are not reported in 'equals()' method implementations. Also, casts are not reported in 'clone()' method implementations. Example: 'interface Entity {}\n class EntityImpl implements Entity {}\n\n void processObject(Object obj) {\n // warning: instanceof of the concrete class\n if (obj instanceof EntityImpl) {\n // warning: cast to the concrete class,\n // rather than the interface\n processEntity((EntityImpl)obj);\n }\n }\n // warning: parameter of concrete class\n void processEntity(EntityImpl obj) {\n }' Use the Ignore abstract class type option to ignore casts to abstract classes. Use the subsequent options to control contexts where the problem is reported.",
"markdown": "Reports usages of concrete classes, rather than interfaces. Such declarations may represent a failure of abstraction and may make testing more difficult.\n\n\nDeclarations whose classes come from system or third-party libraries will not be reported by this inspection.\nCasts, instanceofs, and local variables are not reported in `equals()` method implementations.\nAlso, casts are not reported in `clone()` method implementations.\n\nExample:\n\n\n interface Entity {}\n class EntityImpl implements Entity {}\n\n void processObject(Object obj) {\n // warning: instanceof of the concrete class\n if (obj instanceof EntityImpl) {\n // warning: cast to the concrete class,\n // rather than the interface\n processEntity((EntityImpl)obj);\n }\n }\n // warning: parameter of concrete class\n void processEntity(EntityImpl obj) {\n }\n\n\nUse the **Ignore abstract class type** option to ignore casts to abstract classes.\n\nUse the subsequent options to control contexts where the problem is reported."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UseOfConcreteClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Abstraction issues",
"index": 86,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RedundantLabeledSwitchRuleCodeBlock",
"shortDescription": {
"text": "Labeled switch rule has redundant code block"
},
"fullDescription": {
"text": "Reports labeled rules of 'switch' statements or 'switch' expressions that have a redundant code block. Example: 'String s = switch (n) {\n case 1 -> { yield Integer.toString(n); }\n default -> \"default\";\n };' After the quick-fix is applied: 'String s = switch (n) {\n case 1 -> Integer.toString(n);\n default -> \"default\";\n };' This inspection only reports if the language level of the project or module is 14 or higher. New in 2019.1",
"markdown": "Reports labeled rules of `switch` statements or `switch` expressions that have a redundant code block.\n\nExample:\n\n\n String s = switch (n) {\n case 1 -> { yield Integer.toString(n); }\n default -> \"default\";\n };\n\nAfter the quick-fix is applied:\n\n\n String s = switch (n) {\n case 1 -> Integer.toString(n);\n default -> \"default\";\n };\n\nThis inspection only reports if the language level of the project or module is 14 or higher.\n\nNew in 2019.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "RedundantLabeledSwitchRuleCodeBlock",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "IOStreamConstructor",
"shortDescription": {
"text": "'InputStream' and 'OutputStream' can be constructed using 'Files' methods"
},
"fullDescription": {
"text": "Reports 'new FileInputStream()' or 'new FileOutputStream()' expressions that can be replaced with 'Files.newInputStream()' or 'Files.newOutputStream()' calls respectively. The streams created using 'Files' methods are usually more efficient than those created by stream constructors. Example: 'InputStream is = new BufferedInputStream(new FileInputStream(file));' After the quick-fix is applied: 'InputStream is = new BufferedInputStream(Files.newInputStream(file.toPath()));' This inspection does not show warning if the language level 10 or higher, but the quick-fix is still available. This inspection only reports if the language level of the project or module is 7 or higher. New in 2022.1",
"markdown": "Reports `new FileInputStream()` or `new FileOutputStream()` expressions that can be replaced with `Files.newInputStream()` or `Files.newOutputStream()` calls respectively. \nThe streams created using `Files` methods are usually more efficient than those created by stream constructors.\n\nExample:\n\n\n InputStream is = new BufferedInputStream(new FileInputStream(file));\n\nAfter the quick-fix is applied:\n\n\n InputStream is = new BufferedInputStream(Files.newInputStream(file.toPath()));\n\nThis inspection does not show warning if the language level 10 or higher, but the quick-fix is still available.\n\nThis inspection only reports if the language level of the project or module is 7 or higher.\n\nNew in 2022.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "IOStreamConstructor",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AssignmentToForLoopParameter",
"shortDescription": {
"text": "Assignment to 'for' loop parameter"
},
"fullDescription": {
"text": "Reports assignment to, or modification of a 'for' loop parameter inside the body of the loop. Although occasionally intended, this construct may be confusing and is often the result of a typo or a wrong variable being used. The quick-fix adds a declaration of a new variable. Example: 'for (String s : list) {\n // Warning: s is changed inside the loop\n s = s.trim();\n System.out.println(\"String: \" + s);\n }' After the quick-fix is applied: 'for (String s : list) {\n String trimmed = s.trim();\n System.out.println(\"String: \" + trimmed);\n }' Assignments in basic 'for' loops without an update statement are not reported. In such cases the assignment is probably intended and can't be easily moved to the update part of the 'for' loop. Example: 'for (int i = 0; i < list.size(); ) {\n if (element.equals(list.get(i))) {\n list.remove(i);\n } else {\n // modification of for loop parameter is not reported\n // as there's no update statement\n i++;\n }\n }' Use the Check enhanced 'for' loop parameters option to specify whether modifications of enhanced 'for' loop parameters should be also reported.",
"markdown": "Reports assignment to, or modification of a `for` loop parameter inside the body of the loop.\n\nAlthough occasionally intended, this construct may be confusing and is often the result of a typo or a wrong variable being used.\n\nThe quick-fix adds a declaration of a new variable.\n\n**Example:**\n\n\n for (String s : list) {\n // Warning: s is changed inside the loop\n s = s.trim();\n System.out.println(\"String: \" + s);\n }\n\nAfter the quick-fix is applied:\n\n\n for (String s : list) {\n String trimmed = s.trim();\n System.out.println(\"String: \" + trimmed);\n }\n\nAssignments in basic `for` loops without an update statement are not reported.\nIn such cases the assignment is probably intended and can't be easily moved to the update part of the `for` loop.\n\n**Example:**\n\n\n for (int i = 0; i < list.size(); ) {\n if (element.equals(list.get(i))) {\n list.remove(i);\n } else {\n // modification of for loop parameter is not reported\n // as there's no update statement\n i++;\n }\n }\n\nUse the **Check enhanced 'for' loop parameters** option to specify whether modifications of enhanced `for` loop parameters\nshould be also reported."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AssignmentToForLoopParameter",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Assignment issues",
"index": 87,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java9CollectionFactory",
"shortDescription": {
"text": "Immutable collection creation can be replaced with collection factory call"
},
"fullDescription": {
"text": "Reports 'java.util.Collections' unmodifiable collection calls that can be converted to newer collection factory methods. These can be replaced with e.g. 'List.of()' or 'Set.of()' introduced in Java 9 or 'List.copyOf()' introduced in Java 10. Note that in contrast to 'java.util.Collections' methods, Java 9 collection factory methods: Do not accept 'null' values. Require unique set elements and map keys. Do not accept 'null' arguments to query methods like 'List.contains()' or 'Map.get()' of the collections returned. When these cases are violated, exceptions are thrown. This can change the semantics of the code after the migration. Example: 'List<Integer> even = Collections.unmodifiableList(\n Arrays.asList(2, 4, 6, 8, 10, 2));\n List<Integer> evenCopy = Collections.unmodifiableList(\n new ArrayList<>(list1));' After the quick-fix is applied: 'List<Integer> even = List.of(2, 4, 6, 8, 10, 2);\n List<Integer> evenCopy = List.copyOf(list);' This inspection only reports if the language level of the project or module is 9 or higher. Use the Do not warn when content is non-constant option to report only in cases when the supplied arguments are compile-time constants. This reduces the chances that the behavior changes, because it's not always possible to statically check whether original elements are unique and not 'null'. Use the Suggest 'Map.ofEntries' option to suggest replacing unmodifiable maps with more than 10 entries with 'Map.ofEntries()'. New in 2017.2",
"markdown": "Reports `java.util.Collections` unmodifiable collection calls that can be converted to newer collection factory methods. These can be replaced with e.g. `List.of()` or `Set.of()` introduced in Java 9 or `List.copyOf()` introduced in Java 10.\n\nNote that in contrast to `java.util.Collections` methods, Java 9 collection factory methods:\n\n* Do not accept `null` values.\n* Require unique set elements and map keys.\n* Do not accept `null` arguments to query methods like `List.contains()` or `Map.get()` of the collections returned.\n\nWhen these cases are violated, exceptions are thrown.\nThis can change the semantics of the code after the migration.\n\nExample:\n\n\n List<Integer> even = Collections.unmodifiableList(\n Arrays.asList(2, 4, 6, 8, 10, 2));\n List<Integer> evenCopy = Collections.unmodifiableList(\n new ArrayList<>(list1));\n\nAfter the quick-fix is applied:\n\n\n List<Integer> even = List.of(2, 4, 6, 8, 10, 2);\n List<Integer> evenCopy = List.copyOf(list);\n\nThis inspection only reports if the language level of the project or module is 9 or higher.\n\n\nUse the **Do not warn when content is non-constant** option to report only in cases when the supplied arguments are compile-time constants.\nThis reduces the chances that the behavior changes,\nbecause it's not always possible to statically check whether original elements are unique and not `null`.\n\n\nUse the **Suggest 'Map.ofEntries'** option to suggest replacing unmodifiable maps with more than 10 entries with `Map.ofEntries()`.\n\nNew in 2017.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "Java9CollectionFactory",
"ideaSeverity": "WEAK WARNING",
"qodanaSeverity": "Moderate"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 9",
"index": 88,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MetaAnnotationWithoutRuntimeRetention",
"shortDescription": {
"text": "Test annotation without '@Retention(RUNTIME)' annotation"
},
"fullDescription": {
"text": "Reports annotations with a 'SOURCE' or 'CLASS' retention policy that are supposed to be used by JUnit 5. Such annotations are not available at runtime and most probably their retention policy should be fixed to be accessible through reflection. Note that if the retention policy is not specified, then the default retention policy 'CLASS' is used. Example: '@Testable\n public @interface UnitTest {}' After the quick-fix is applied: '@Retention(RetentionPolicy.RUNTIME)\n @Testable\n public @interface UnitTest {}'",
"markdown": "Reports annotations with a `SOURCE` or `CLASS` retention policy that are supposed to be used by JUnit 5. Such annotations are not available at runtime and most probably their retention policy should be fixed to be accessible through reflection.\n\nNote that if the retention policy is not specified, then the default retention policy `CLASS` is used.\n\n**Example:**\n\n\n @Testable\n public @interface UnitTest {}\n\nAfter the quick-fix is applied:\n\n\n @Retention(RetentionPolicy.RUNTIME)\n @Testable\n public @interface UnitTest {}\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "MetaAnnotationWithoutRuntimeRetention",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/JUnit",
"index": 91,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryContinue",
"shortDescription": {
"text": "Unnecessary 'continue' statement"
},
"fullDescription": {
"text": "Reports 'continue' statements if they are the last reachable statements in the loop. These 'continue' statements are unnecessary and can be safely removed. Example: 'for (String element: elements) {\n System.out.println();\n continue;\n }' After the quick-fix is applied: 'for (String element: elements) {\n System.out.println();\n }' The inspection doesn't analyze JSP files. Use the Ignore in then branch of 'if' statement with 'else' branch option to ignore 'continue' statements when they are placed in a 'then' branch of a complete 'if'-'else' statement. Example: 'for (String element: elements) {\n if(element.isEmpty()) {\n continue;\n } else {\n //...\n }\n }'",
"markdown": "Reports `continue` statements if they are the last reachable statements in the loop. These `continue` statements are unnecessary and can be safely removed.\n\nExample:\n\n\n for (String element: elements) {\n System.out.println();\n continue;\n }\n\nAfter the quick-fix is applied:\n\n\n for (String element: elements) {\n System.out.println();\n }\n\nThe inspection doesn't analyze JSP files.\n\n\nUse the **Ignore in then branch of 'if' statement with 'else' branch** option to ignore\n`continue` statements when they are placed in a `then` branch of a complete\n`if`-`else` statement.\n\nExample:\n\n\n for (String element: elements) {\n if(element.isEmpty()) {\n continue;\n } else {\n //...\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryContinue",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CStyleArrayDeclaration",
"shortDescription": {
"text": "C-style array declaration"
},
"fullDescription": {
"text": "Reports array declarations written in C-style syntax, where the array brackets are placed after a variable name or after a method parameter list. Most code styles prefer Java-style array declarations, where the array brackets are placed after the type name. Example: 'public String process(String value[])[] {\n return value;\n }' After the quick-fix is applied: 'public String[] process(String[] value) {\n return value;\n }' Configure the inspection: Use the Ignore C-style declarations in variables option to report C-style array declaration of method return types only.",
"markdown": "Reports array declarations written in C-style syntax, where the array brackets are placed after a variable name or after a method parameter list. Most code styles prefer Java-style array declarations, where the array brackets are placed after the type name.\n\n**Example:**\n\n\n public String process(String value[])[] {\n return value;\n }\n\nAfter the quick-fix is applied:\n\n\n public String[] process(String[] value) {\n return value;\n }\n\nConfigure the inspection:\n\n\nUse the **Ignore C-style declarations in variables** option to report C-style array declaration of method return types only."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "CStyleArrayDeclaration",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SystemExit",
"shortDescription": {
"text": "Call to 'System.exit()' or related methods"
},
"fullDescription": {
"text": "Reports calls to 'System.exit()', 'Runtime.exit()', and 'Runtime.halt()'. Invoking 'System.exit()' or 'Runtime.exit()' calls the shutdown hooks and terminates the currently running Java virtual machine. Invoking 'Runtime.halt()' forcibly terminates the JVM without causing shutdown hooks to be started. Each of these methods should be used with extreme caution. Calls to these methods make the calling code unportable to most application servers. Use the option to ignore calls in main methods.",
"markdown": "Reports calls to `System.exit()`, `Runtime.exit()`, and `Runtime.halt()`.\n\n\nInvoking `System.exit()` or `Runtime.exit()`\ncalls the shutdown hooks and terminates the currently running Java\nvirtual machine. Invoking `Runtime.halt()` forcibly\nterminates the JVM without causing shutdown hooks to be started.\nEach of these methods should be used with extreme caution. Calls\nto these methods make the calling code unportable to most\napplication servers.\n\n\nUse the option to ignore calls in main methods."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CallToSystemExit",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Portability",
"index": 95,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "DeclareCollectionAsInterface",
"shortDescription": {
"text": "Collection declared by class, not interface"
},
"fullDescription": {
"text": "Reports declarations of 'Collection' variables made by using the collection class as a type, rather than an appropriate interface. The warning is not issued if weakening the variable type will cause a compilation error. Example: '// Warning: concrete collection class ArrayList used.\n int getTotalLength(ArrayList<String> list) {\n return list.stream().mapToInt(String::length).sum();\n }\n\n // No warning, as trimToSize() method is not\n // available in the List interface\n void addData(ArrayList<String> data) {\n data.add(\"Hello\");\n data.add(\"World\");\n data.trimToSize();\n }' A quick-fix is suggested to use the appropriate collection interface (e.g. 'Collection', 'Set', or 'List').",
"markdown": "Reports declarations of `Collection` variables made by using the collection class as a type, rather than an appropriate interface. The warning is not issued if weakening the variable type will cause a compilation error.\n\nExample:\n\n\n // Warning: concrete collection class ArrayList used.\n int getTotalLength(ArrayList<String> list) {\n return list.stream().mapToInt(String::length).sum();\n }\n\n // No warning, as trimToSize() method is not\n // available in the List interface\n void addData(ArrayList<String> data) {\n data.add(\"Hello\");\n data.add(\"World\");\n data.trimToSize();\n }\n\nA quick-fix is suggested to use the appropriate collection interface (e.g. `Collection`, `Set`, or `List`)."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CollectionDeclaredAsConcreteClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Abstraction issues",
"index": 86,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TrivialStringConcatenation",
"shortDescription": {
"text": "Concatenation with empty string"
},
"fullDescription": {
"text": "Reports empty string operands in string concatenations. Concatenation with the empty string can be used to convert non-'String' objects or primitives into 'String's, but it can be clearer to use a 'String.valueOf()' method call. A quick-fix is suggested to simplify the concatenation. Example: 'void foo(int x, int y) {\n String s = \"\" + x + \" ; \" + y;\n }' After the quick-fix is applied: 'void foo(int x, int y) {\n String s = x + \" ; \" + y;\n }' Use the Report only where empty strings can be removed without other changes option to ignore cases cases where removing the empty string will require adding a 'String.valueOf()' conversion of another operand.",
"markdown": "Reports empty string operands in string concatenations. Concatenation with the empty string can be used to convert non-`String` objects or primitives into `String`s, but it can be clearer to use a `String.valueOf()` method call.\n\n\nA quick-fix is suggested to simplify the concatenation.\n\n**Example:**\n\n\n void foo(int x, int y) {\n String s = \"\" + x + \" ; \" + y;\n }\n\nAfter the quick-fix is applied:\n\n\n void foo(int x, int y) {\n String s = x + \" ; \" + y;\n }\n\n\nUse the **Report only where empty strings can be removed without other changes**\noption to ignore cases cases where removing the empty string\nwill require adding a `String.valueOf()` conversion of another operand."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ConcatenationWithEmptyString",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SuspiciousInvocationHandlerImplementation",
"shortDescription": {
"text": "Suspicious 'InvocationHandler' implementation"
},
"fullDescription": {
"text": "Reports implementations of 'InvocationHandler' that do not proxy standard 'Object' methods like 'hashCode()', 'equals()', and 'toString()'. Failing to handle these methods might cause unexpected problems upon calling them on a proxy instance. Example: 'InvocationHandler myHandler = (proxy, method, params) -> {\n System.out.println(\"Hello World!\");\n return null;\n };\n Runnable myProxy = (Runnable) Proxy.newProxyInstance(\n Thread.currentThread().getContextClassLoader(),\n new Class[] {Runnable.class}, myHandler\n );' This code snippet is designed to only proxy the 'Runnable.run()' method. However, calls to any 'Object' methods, like 'hashCode()', are proxied as well. This can lead to problems like a 'NullPointerException', for example, when adding 'myProxy' to a 'HashSet'. New in 2020.2",
"markdown": "Reports implementations of `InvocationHandler` that do not proxy standard `Object` methods like `hashCode()`, `equals()`, and `toString()`.\n\nFailing to handle these methods might cause unexpected problems upon calling them on a proxy instance.\n\n**Example:**\n\n\n InvocationHandler myHandler = (proxy, method, params) -> {\n System.out.println(\"Hello World!\");\n return null;\n };\n Runnable myProxy = (Runnable) Proxy.newProxyInstance(\n Thread.currentThread().getContextClassLoader(),\n new Class[] {Runnable.class}, myHandler\n );\n\n\nThis code snippet is designed to only proxy the `Runnable.run()` method.\nHowever, calls to any `Object` methods, like `hashCode()`, are proxied as well.\nThis can lead to problems like a `NullPointerException`, for example, when adding `myProxy` to a `HashSet`.\n\nNew in 2020.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SuspiciousInvocationHandlerImplementation",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "HtmlTagCanBeJavadocTag",
"shortDescription": {
"text": "'<code>...</code>' can be replaced with '{@code ...}'"
},
"fullDescription": {
"text": "Reports usages of '<code>' tags in Javadoc comments. Since Java 5, these tags can be replaced with '{@code ...}' constructs. This allows using angle brackets '<' and '>' inside the comment instead of HTML character entities. Example: '/**\n * @return empty <code>ArrayList&lt;Integer&gt;</code>\n */\n List<Integer> getList(){ ... }' After the quick-fix is applied: '/**\n * @return empty {@code ArrayList<Integer>}\n */\n List<Integer> getList(){ ... }'",
"markdown": "Reports usages of `<code>` tags in Javadoc comments. Since Java 5, these tags can be replaced with `{@code ...}` constructs. This allows using angle brackets `<` and `>` inside the comment instead of HTML character entities.\n\n**Example:**\n\n\n /**\n * @return empty <code>ArrayList&lt;Integer&gt;</code>\n */\n List<Integer> getList(){ ... }\n\nAfter the quick-fix is applied:\n\n\n /**\n * @return empty {@code ArrayList<Integer>}\n */\n List<Integer> getList(){ ... }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "HtmlTagCanBeJavadocTag",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Javadoc",
"index": 79,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassEscapesItsScope",
"shortDescription": {
"text": "Class is exposed outside of its visibility scope"
},
"fullDescription": {
"text": "Reports usages of classes in a field or method signature where the class has less visibility than the member that uses it. While legal Java, such members cannot be used outside of the visibility scope of the class type they reference. Example: 'public class Parent {\n public Child getChild() {\n return new Child();\n }\n\n private class Child {}\n }' Additionally, in Java 9 and higher, a module may hide some of its classes from other modules by not exporting their packages. However, if a member that is part of the exported API references a non-exported class in its signature, such a member cannot be used outside of the module. Configure the inspection: Use the Report non-exported classes exposed in module API (Java 9+) option to report module API members that expose non-exported classes. Note that the language level of the project or module needs to be 9 or higher for this option. Use the Report non-accessible classes exposed in public API option to report on public members that expose classes with a smaller visibility scope. Use the Report private classes exposed in package-local API option to report on package-local members that expose 'private' classes.",
"markdown": "Reports usages of classes in a field or method signature where the class has less visibility than the member that uses it. While legal Java, such members cannot be used outside of the visibility scope of the class type they reference.\n\n**Example:**\n\n\n public class Parent {\n public Child getChild() {\n return new Child();\n }\n\n private class Child {}\n }\n\n\nAdditionally, in Java 9 and higher, a module may hide some of its classes from other modules by not exporting their packages.\nHowever, if a member that is part of the exported API references a non-exported class in its signature,\nsuch a member cannot be used outside of the module.\n\nConfigure the inspection:\n\n* Use the **Report non-exported classes exposed in module API (Java 9+)** option to report module API members that expose non-exported classes. \n Note that the language level of the project or module needs to be 9 or higher for this option.\n* Use the **Report non-accessible classes exposed in public API** option to report on public members that expose classes with a smaller visibility scope.\n* Use the **Report private classes exposed in package-local API** option to report on package-local members that expose `private` classes."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ClassEscapesDefinedScope",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Visibility",
"index": 99,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "EqualsUsesNonFinalVariable",
"shortDescription": {
"text": "Non-final field referenced in 'equals()'"
},
"fullDescription": {
"text": "Reports implementations of 'equals()' that access non-'final' variables. Such access may result in 'equals()' returning different results at different points in the object's lifecycle, which may in turn cause problems when using the standard collections classes. Example: 'public class Person {\n private String lastName;\n\n @Override\n public boolean equals(Object obj) {\n ...\n Person other = (Person) obj;\n if (lastName == null) {\n if (!lastName.equals(other.lastName)) {\n return false;\n ...\n }\n }\n }'",
"markdown": "Reports implementations of `equals()` that access non-`final` variables. Such access may result in `equals()` returning different results at different points in the object's lifecycle, which may in turn cause problems when using the standard collections classes.\n\n**Example:**\n\n\n public class Person {\n private String lastName;\n\n @Override\n public boolean equals(Object obj) {\n ...\n Person other = (Person) obj;\n if (lastName == null) {\n if (!lastName.equals(other.lastName)) {\n return false;\n ...\n }\n }\n }\n \n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonFinalFieldReferenceInEquals",
"cweIds": [
697
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NestedAssignment",
"shortDescription": {
"text": "Nested assignment"
},
"fullDescription": {
"text": "Reports assignment expressions that are nested inside other expressions. Such expressions may be confusing and violate the general design principle, which states that any construct should do precisely one thing. Example: 'String userName;\n // Warning: result of assignment to 'userName' is used\n String message = \"Hello \" + (userName = \"Alice\") + \"!\"\n System.out.println(message);\n System.out.println(\"Goodbye \" + userName);'",
"markdown": "Reports assignment expressions that are nested inside other expressions.\n\nSuch expressions may be confusing and violate the general design principle, which states that any construct should do precisely one thing.\n\n**Example:**\n\n\n String userName;\n // Warning: result of assignment to 'userName' is used\n String message = \"Hello \" + (userName = \"Alice\") + \"!\"\n System.out.println(message);\n System.out.println(\"Goodbye \" + userName);\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NestedAssignment",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Assignment issues",
"index": 87,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AutoUnboxing",
"shortDescription": {
"text": "Auto-unboxing"
},
"fullDescription": {
"text": "Reports expressions that are affected by unboxing conversion (automatic unwrapping of objects into primitive values). Try not to use objects instead of primitives. It might significantly affect the performance. Example: 'int x = new Integer(42);' The quick-fix makes the conversion explicit: 'int x = new Integer(42).intValue();' AutoUnboxing appeared in Java 5. This inspection can help to downgrade for backward compatibility with earlier Java versions.",
"markdown": "Reports expressions that are affected by unboxing conversion (automatic unwrapping of objects into primitive values). Try not to use objects instead of primitives. It might significantly affect the performance.\n\n**Example:**\n\n int x = new Integer(42);\n\nThe quick-fix makes the conversion explicit:\n\n int x = new Integer(42).intValue();\n\n\n*AutoUnboxing* appeared in Java 5.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AutoUnboxing",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StringConcatenationInMessageFormatCall",
"shortDescription": {
"text": "String concatenation as argument to 'MessageFormat.format()' call"
},
"fullDescription": {
"text": "Reports non-constant string concatenations used as an argument to a call to 'MessageFormat.format()'. While occasionally intended, this is usually a misuse of the formatting method and may even cause unexpected exceptions if the variables used in the concatenated string contain special characters like '{'. Also, sometimes this could be the result of mistakenly concatenating a string format argument by typing a '+' when a ',' was meant. Example: 'String formatGreeting(String userName, int balance) {\n return MessageFormat.format(\"Hello, \" + userName + \"! Your balance is {0}.\", balance);\n }' Here, the 'userName' will be interpreted as a part of the format string, which may result in 'IllegalArgumentException' (for example, if 'userName' is '\"{\"'). This call should be probably replaced with 'MessageFormat.format(\"Hello, {0}! Your balance is {1}.\", userName, balance)'.",
"markdown": "Reports non-constant string concatenations used as an argument to a call to `MessageFormat.format()`.\n\n\nWhile occasionally intended, this is usually a misuse of the formatting method\nand may even cause unexpected exceptions if the variables used in the concatenated string contain\nspecial characters like `{`.\n\n\nAlso, sometimes this could be the result\nof mistakenly concatenating a string format argument by typing a `+` when a `,` was meant.\n\n**Example:**\n\n\n String formatGreeting(String userName, int balance) {\n return MessageFormat.format(\"Hello, \" + userName + \"! Your balance is {0}.\", balance);\n }\n\n\nHere, the `userName` will be interpreted as a part of the format string, which may result\nin `IllegalArgumentException` (for example, if `userName` is `\"{\"`).\nThis call should be probably replaced with `MessageFormat.format(\"Hello, {0}! Your balance is {1}.\", userName, balance)`."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "StringConcatenationInMessageFormatCall",
"cweIds": [
116,
134
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NonFinalFieldInImmutable",
"shortDescription": {
"text": "Non-final field in '@Immutable' class"
},
"fullDescription": {
"text": "Reports any non-final field in a class with the '@Immutable' annotation. This violates the contract of the '@Immutable' annotation. Example: 'import javax.annotation.concurrent.Immutable;\n @Immutable\n class Foo {\n String bar = \"foo\";\n }' Supported '@GuardedBy' annotations are: 'net.jcip.annotations.GuardedBy' 'javax.annotation.concurrent.GuardedBy' 'org.apache.http.annotation.GuardedBy' 'com.android.annotations.concurrency.GuardedBy' 'androidx.annotation.GuardedBy' 'com.google.errorprone.annotations.concurrent.GuardedBy'",
"markdown": "Reports any non-final field in a class with the `@Immutable` annotation. This violates the contract of the `@Immutable` annotation.\n\nExample:\n\n\n import javax.annotation.concurrent.Immutable;\n @Immutable\n class Foo {\n String bar = \"foo\";\n }\n\nSupported `@GuardedBy` annotations are:\n\n* `net.jcip.annotations.GuardedBy`\n* `javax.annotation.concurrent.GuardedBy`\n* `org.apache.http.annotation.GuardedBy`\n* `com.android.annotations.concurrency.GuardedBy`\n* `androidx.annotation.GuardedBy`\n* `com.google.errorprone.annotations.concurrent.GuardedBy`"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonFinalFieldInImmutable",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Concurrency annotation issues",
"index": 101,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CallToStringConcatCanBeReplacedByOperator",
"shortDescription": {
"text": "Call to 'String.concat()' can be replaced with '+'"
},
"fullDescription": {
"text": "Reports calls to 'java.lang.String.concat()'. Such calls can be replaced with the '+' operator for clarity and possible increased performance if the method was invoked on a constant with a constant argument. Example: 'String foo(String name) {\n return name.concat(\"foo\");\n }' After the quick-fix is applied: 'String foo(String name) {\n return name + \"foo\";\n }'",
"markdown": "Reports calls to `java.lang.String.concat()`.\n\n\nSuch calls can be replaced with the `+` operator for clarity and possible increased\nperformance if the method was invoked on a constant with a constant argument.\n\n**Example:**\n\n\n String foo(String name) {\n return name.concat(\"foo\");\n }\n\nAfter the quick-fix is applied:\n\n\n String foo(String name) {\n return name + \"foo\";\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CallToStringConcatCanBeReplacedByOperator",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ExpectedExceptionNeverThrown",
"shortDescription": {
"text": "Expected exception never thrown in test method body"
},
"fullDescription": {
"text": "Reports checked exceptions expected by a JUnit 4 test-method that are never thrown inside the method body. Such test methods will never succeed. Example: '@Test(expected = CloneNotSupportedException.class)\n public void testIt() {\n }'",
"markdown": "Reports checked exceptions expected by a JUnit 4 test-method that are never thrown inside the method body. Such test methods will never succeed.\n\n**Example:**\n\n\n @Test(expected = CloneNotSupportedException.class)\n public void testIt() {\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ExpectedExceptionNeverThrown",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/JUnit",
"index": 91,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "HardcodedFileSeparators",
"shortDescription": {
"text": "Hardcoded file separator"
},
"fullDescription": {
"text": "Reports the forward ('/') or backward ('\\') slash in a string or character literal. These characters are commonly used as file separators, and portability may suffer if they are hardcoded. The inspection will not report backward slashes inside escape sequences and forward slashes immediately following the '<' character or immediately preceding the '>' character, as those often indicate XML or HTML tags rather than file names. Strings representing a 'java.util.TimeZone' ID, strings that are valid regular expressions, or strings that equal IANA-registered MIME media types will not be reported either. Example: 'new File(\"C:\\\\Users\\\\Name\");' Use the option to include 'example/*' in the set of recognized media types. Normally, usage of the 'example/*' MIME media type outside of an example (e.g. in a 'Content-Type' header) is an error.",
"markdown": "Reports the forward (`/`) or backward (`\\`) slash in a string or character literal. These characters are commonly used as file separators, and portability may suffer if they are hardcoded.\n\n\nThe inspection will not report backward slashes inside escape sequences and forward slashes immediately following the '\\<' character\nor immediately preceding the '\\>' character, as those often indicate XML or HTML tags rather than file names.\nStrings representing a `java.util.TimeZone` ID, strings that are valid regular expressions,\nor strings that equal IANA-registered MIME media types will not be reported either.\n\n**Example:**\n\n\n new File(\"C:\\\\Users\\\\Name\");\n\n\nUse the option to include `example/*` in the set of recognized media types.\nNormally, usage of the `example/*` MIME media type outside of an example (e.g. in a `Content-Type`\nheader) is an error."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "HardcodedFileSeparator",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Portability",
"index": 95,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ConfusingFloatingPointLiteral",
"shortDescription": {
"text": "Confusing floating-point literal"
},
"fullDescription": {
"text": "Reports any floating point numbers that don't have a decimal point, numbers before the decimal point, or numbers after the decimal point. Such literals may be confusing, and violate several coding standards. Example: 'double d = .03;' After the quick-fix is applied: 'double d = 0.03;' Use the Ignore floating point literals in scientific notation option to ignore floating point numbers in scientific notation.",
"markdown": "Reports any floating point numbers that don't have a decimal point, numbers before the decimal point, or numbers after the decimal point.\n\nSuch literals may be confusing, and violate several coding standards.\n\n**Example:**\n\n double d = .03;\n\nAfter the quick-fix is applied:\n\n double d = 0.03;\n\n\nUse the **Ignore floating point literals in scientific notation** option to ignore floating point numbers in scientific notation."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ConfusingFloatingPointLiteral",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavadocReference",
"shortDescription": {
"text": "Declaration has problems in Javadoc references"
},
"fullDescription": {
"text": "Reports unresolved references inside Javadoc comments. In the following example, the 'someParam' parameter is missing, so it will be highlighted: 'class A {\n /**\n * @param someParam description\n **/\n void foo() {\n }\n}' Disable the Report inaccessible symbols option to ignore the tags that reference missing method parameters, classes, fields and methods.",
"markdown": "Reports unresolved references inside Javadoc comments.\n\nIn the following example, the `someParam` parameter is missing, so it will be highlighted:\n\n\n class A {\n /**\n * @param someParam description\n **/\n void foo() {\n }\n }\n\n\nDisable the **Report inaccessible symbols** option to ignore the tags that reference missing method parameters,\nclasses, fields and methods."
},
"defaultConfiguration": {
"enabled": true,
"level": "error",
"parameters": {
"suppressToolId": "JavadocReference",
"ideaSeverity": "ERROR",
"qodanaSeverity": "Critical"
}
},
"relationships": [
{
"target": {
"id": "Java/Javadoc",
"index": 79,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LoggingPlaceholderCountMatchesArgumentCount",
"shortDescription": {
"text": "Number of placeholders does not match number of arguments in logging call"
},
"fullDescription": {
"text": "Reports SLF4J, Log4j2 and akka.event.LoggingAdapter logging calls, such as 'logger.info(\"{}: {}\", key)' where the number of '{}' placeholders in the logger message doesn't match the number of other arguments to the logging call. Use the inspection option to specify which implementation SLF4J uses. If Check automatically is chosen, then 'org.apache.logging.slf4j.Log4jLogger' is searched in the classpath. If this file is founded or Yes is chosen, then cases, when the last parameter with an exception type has a placeholder, will not be reported for SLFJ4 API. For example: '//this case will not be reported with \"Yes\" option\nlog.error(\"For id {}: {}\", \"1\", new RuntimeException());' In this case 'new RuntimeException()' will be printed using 'toString()', (its stacktrace will not be printed): 'For id 1: java.lang.RuntimeException' Otherwise, it will be highlighted because the last placeholder is not used: 'For id 1: {}\njava.lang.RuntimeException: null' No option can be used to always highlight such cases when a placeholder is used for an exception even if 'org.apache.logging.slf4j.Log4jLogger' is used as a backend. This option works only for SLF4J.",
"markdown": "Reports SLF4J, Log4j2 and akka.event.LoggingAdapter logging calls, such as `logger.info(\"{}: {}\", key)` where the number of `{}` placeholders in the logger message doesn't match the number of other arguments to the logging call.\n\n\nUse the inspection option to specify which implementation SLF4J uses.\nIf **Check automatically** is chosen, then `org.apache.logging.slf4j.Log4jLogger` is searched in the classpath.\nIf this file is founded or **Yes** is chosen, then cases, when the last parameter with an exception type has a placeholder,\nwill not be reported for SLFJ4 API. \n\nFor example:\n\n\n //this case will not be reported with \"Yes\" option\n log.error(\"For id {}: {}\", \"1\", new RuntimeException());\n\nIn this case 'new RuntimeException()' will be printed using 'toString()', (its stacktrace will not be printed):\n\n\n For id 1: java.lang.RuntimeException\n\nOtherwise, it will be highlighted because the last placeholder is not used:\n\n\n For id 1: {}\n java.lang.RuntimeException: null\n\n**No** option can be used to always highlight such cases when a placeholder is used for an exception even if `org.apache.logging.slf4j.Log4jLogger` is used as a backend. \nThis option works only for SLF4J."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "LoggingPlaceholderCountMatchesArgumentCount",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Logging",
"index": 52,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ImplicitArrayToString",
"shortDescription": {
"text": "Call to 'toString()' on array"
},
"fullDescription": {
"text": "Reports arrays used in 'String' concatenations or passed as parameters to 'java.io.PrintStream' methods, such as 'System.out.println()'. Usually, the content of the array is meant to be used and not the array object itself. Example: 'void print(Object[] objects) {\n System.out.println(objects);\n }' After the quick-fix is applied: 'void print(Object[] objects) {\n System.out.println(Arrays.toString(objects));\n }'",
"markdown": "Reports arrays used in `String` concatenations or passed as parameters to `java.io.PrintStream` methods, such as `System.out.println()`.\n\n\nUsually, the content of the array is meant to be used and not the array object itself.\n\n**Example:**\n\n\n void print(Object[] objects) {\n System.out.println(objects);\n }\n\nAfter the quick-fix is applied:\n\n\n void print(Object[] objects) {\n System.out.println(Arrays.toString(objects));\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ImplicitArrayToString",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ReuseOfLocalVariable",
"shortDescription": {
"text": "Reuse of local variable"
},
"fullDescription": {
"text": "Reports local variables that are \"reused\" overwriting their values with new values unrelated to their original use. Such a local variable reuse may be confusing, as the intended semantics of the local variable may vary with each use. It may also be prone to bugs if due to the code changes, the values that have been considered overwritten actually appear to be alive. It is a good practice to keep variable lifetimes as short as possible, and not to reuse local variables for the sake of brevity. Example: 'void x() {\n String s = \"one\";\n System.out.println(\"s = \" + s);\n s = \"two\"; //reuse of local variable 's'\n System.out.println(\"s = \" + s);\n }'",
"markdown": "Reports local variables that are \"reused\" overwriting their values with new values unrelated to their original use.\n\nSuch a local variable reuse may be confusing,\nas the intended semantics of the local variable may vary with each use. It may also be\nprone to bugs if due to the code changes, the values that have been considered overwritten actually\nappear to be alive. It is a good practice to keep variable lifetimes as short as possible, and not\nto reuse local variables for the sake of brevity.\n\nExample:\n\n\n void x() {\n String s = \"one\";\n System.out.println(\"s = \" + s);\n s = \"two\"; //reuse of local variable 's'\n System.out.println(\"s = \" + s);\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "ReuseOfLocalVariable",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Data flow",
"index": 65,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "BooleanMethodNameMustStartWithQuestion",
"shortDescription": {
"text": "Boolean method name must start with question word"
},
"fullDescription": {
"text": "Reports boolean methods whose names do not start with a question word. Boolean methods that override library methods are ignored by this inspection. Example: 'boolean empty(List<String> list) {\n return list.isEmpty();\n}' A quick-fix that renames such methods is available only in the editor. Configure the inspection: Use the Boolean method name prefixes list to specify acceptable question words to start boolean method names with. Use the Ignore methods with 'java.lang.Boolean' return type option to ignore methods with the 'java.lang.Boolean' return type. Use the Ignore boolean methods in an @interface option to ignore boolean methods in annotation types ('@interface'). Use the Ignore methods overriding/implementing a super method to ignore methods the have supers.",
"markdown": "Reports boolean methods whose names do not start with a question word.\n\nBoolean methods that override library methods are ignored by this inspection.\n\n**Example:**\n\n boolean empty(List<String> list) {\n return list.isEmpty();\n }\n\nA quick-fix that renames such methods is available only in the editor.\n\nConfigure the inspection:\n\n* Use the **Boolean method name prefixes** list to specify acceptable question words to start boolean method names with.\n* Use the **Ignore methods with 'java.lang.Boolean' return type** option to ignore methods with the `java.lang.Boolean` return type.\n* Use the **Ignore boolean methods in an @interface** option to ignore boolean methods in annotation types (`@interface`).\n* Use the **Ignore methods overriding/implementing a super method** to ignore methods the have supers."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "BooleanMethodNameMustStartWithQuestion",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Naming conventions/Method",
"index": 108,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SynchronizationOnLocalVariableOrMethodParameter",
"shortDescription": {
"text": "Synchronization on local variable or method parameter"
},
"fullDescription": {
"text": "Reports synchronization on a local variable or parameter. It is very difficult to guarantee correct operation when such synchronization is used. It may be possible to improve such code, for example, by controlling access using a synchronized wrapper class or by synchronizing on a field. Example: 'void bar() {\n final Object lock = new Object();\n synchronized (lock) { }\n }'",
"markdown": "Reports synchronization on a local variable or parameter.\n\n\nIt is very difficult to guarantee correct operation when such synchronization is used.\nIt may be possible to improve such code, for example, by controlling access using a synchronized wrapper class or by synchronizing on a\nfield.\n\n**Example:**\n\n\n void bar() {\n final Object lock = new Object();\n synchronized (lock) { }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SynchronizationOnLocalVariableOrMethodParameter",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NegatedConditionalExpression",
"shortDescription": {
"text": "Negated conditional expression"
},
"fullDescription": {
"text": "Reports conditional expressions which are negated with a prefix expression, as such constructions may be confusing. There is a fix that propagates the outer negation to both branches. Example: '!(i == 1 ? a : b)' After the quick-fix is applied: 'i == 1 ? !a : !b'",
"markdown": "Reports conditional expressions which are negated with a prefix expression, as such constructions may be confusing.\n\nThere is a fix that propagates the outer negation to both branches.\n\nExample:\n\n\n !(i == 1 ? a : b)\n\nAfter the quick-fix is applied:\n\n\n i == 1 ? !a : !b\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NegatedConditionalExpression",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "FinalMethod",
"shortDescription": {
"text": "Method can't be overridden"
},
"fullDescription": {
"text": "Reports methods that are declared 'final'. Such methods can't be overridden and may indicate a lack of object-oriented design. Some coding standards discourage 'final' methods.",
"markdown": "Reports methods that are declared `final`. Such methods can't be overridden and may indicate a lack of object-oriented design. Some coding standards discourage `final` methods."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "FinalMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SuspiciousSystemArraycopy",
"shortDescription": {
"text": "Suspicious 'System.arraycopy()' call"
},
"fullDescription": {
"text": "Reports suspicious calls to 'System.arraycopy()'. Such calls are suspicious when: the source or destination is not of an array type the source and destination are of different types the copied chunk length is greater than 'src.length - srcPos' the copied chunk length is greater than 'dest.length - destPos' the ranges always intersect when the source and destination are the same array Example: 'void foo() {\n int[] src = new int[] { 1, 2, 3, 4 };\n System.arraycopy(src, 0, src, 1, 2); // warning: Copying to the same array with intersecting ranges\n }'",
"markdown": "Reports suspicious calls to `System.arraycopy()`.\n\nSuch calls are suspicious when:\n\n* the source or destination is not of an array type\n* the source and destination are of different types\n* the copied chunk length is greater than `src.length - srcPos`\n* the copied chunk length is greater than `dest.length - destPos`\n* the ranges always intersect when the source and destination are the same array\n\n**Example:**\n\n\n void foo() {\n int[] src = new int[] { 1, 2, 3, 4 };\n System.arraycopy(src, 0, src, 1, 2); // warning: Copying to the same array with intersecting ranges\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SuspiciousSystemArraycopy",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AbsoluteAlignmentInUserInterface",
"shortDescription": {
"text": "Absolute alignment in AWT/Swing code"
},
"fullDescription": {
"text": "Reports usages of absolute alignment constants from AWT and Swing. Internationalized applications use relative alignment because it respects the locale component orientation settings. Example: 'JPanel panel = new JPanel(new BorderLayout(2, 2));\n JLabel label = new JLabel(\"Hello World\");\n panel.add(label, BorderLayout.NORTH);' After the quick-fix is applied: 'JPanel panel = new JPanel(new BorderLayout(2, 2));\n JLabel label = new JLabel(\"Hello World\");\n panel.add(label, BorderLayout.PAGE_START);'",
"markdown": "Reports usages of absolute alignment constants from AWT and Swing. Internationalized applications use relative alignment because it respects the locale component orientation settings.\n\n**Example:**\n\n\n JPanel panel = new JPanel(new BorderLayout(2, 2));\n JLabel label = new JLabel(\"Hello World\");\n panel.add(label, BorderLayout.NORTH);\n\nAfter the quick-fix is applied:\n\n\n JPanel panel = new JPanel(new BorderLayout(2, 2));\n JLabel label = new JLabel(\"Hello World\");\n panel.add(label, BorderLayout.PAGE_START);\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AbsoluteAlignmentInUserInterface",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Internationalization",
"index": 6,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RedundantLambdaParameterType",
"shortDescription": {
"text": "Redundant lambda parameter types"
},
"fullDescription": {
"text": "Reports lambda formal parameter types that are redundant because they can be inferred from the context. Example: 'Map<String, Integer> map = ...\n map.forEach((String s, Integer i) -> log.info(s + \"=\" + i));' The quick-fix removes the parameter types from the lambda. 'Map<String, Integer> map = ...\n map.forEach((s, i) -> log.info(s + \"=\" + i));'",
"markdown": "Reports lambda formal parameter types that are redundant because they can be inferred from the context.\n\n**Example:**\n\n\n Map<String, Integer> map = ...\n map.forEach((String s, Integer i) -> log.info(s + \"=\" + i));\n\nThe quick-fix removes the parameter types from the lambda.\n\n\n Map<String, Integer> map = ...\n map.forEach((s, i) -> log.info(s + \"=\" + i));\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "RedundantLambdaParameterType",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Declaration redundancy",
"index": 12,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SuspiciousReturnByteInputStream",
"shortDescription": {
"text": "Suspicious byte value returned from 'InputStream.read()'"
},
"fullDescription": {
"text": "Reports expressions of 'byte' type returned from a method implementing the 'InputStream.read()' method. This is suspicious because 'InputStream.read()' should return a value in the range from '0' to '255', while an expression of byte type contains a value from '-128' to '127'. The quick-fix converts the expression into an unsigned 'byte' by applying the bitmask '0xFF'. Example: 'class MyInputStream extends InputStream {\n int pos = 0;\n byte[] data;\n\n MyInputStream(byte[] input) {\n data = input;\n }\n\n @Override\n public int read() {\n if (pos == data.length) {\n return -1;\n }\n return data[pos++]; // problem\n }\n}' After applying the quick-fix: 'class MyInputStream extends InputStream {\n int pos = 0;\n byte[] data;\n\n MyInputStream(byte[] input) {\n data = input;\n }\n\n @Override\n public int read() {\n if (pos == data.length) {\n return -1;\n }\n return data[pos++] & 0xFF;\n }\n}' New in 2023.2",
"markdown": "Reports expressions of `byte` type returned from a method implementing the `InputStream.read()` method.\n\n\nThis is suspicious because `InputStream.read()` should return a value in the range from `0` to `255`,\nwhile an expression of byte type contains a value from `-128` to `127`.\nThe quick-fix converts the expression into an unsigned `byte` by applying the bitmask `0xFF`.\n\n**Example:**\n\n\n class MyInputStream extends InputStream {\n int pos = 0;\n byte[] data;\n\n MyInputStream(byte[] input) {\n data = input;\n }\n\n @Override\n public int read() {\n if (pos == data.length) {\n return -1;\n }\n return data[pos++]; // problem\n }\n }\n\nAfter applying the quick-fix:\n\n\n class MyInputStream extends InputStream {\n int pos = 0;\n byte[] data;\n\n MyInputStream(byte[] input) {\n data = input;\n }\n\n @Override\n public int read() {\n if (pos == data.length) {\n return -1;\n }\n return data[pos++] & 0xFF;\n }\n }\n\nNew in 2023.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SuspiciousReturnByteInputStream",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ConditionalExpression",
"shortDescription": {
"text": "Conditional expression"
},
"fullDescription": {
"text": "Reports usages of the ternary condition operator and suggests converting them to 'if'/'else' statements. Some code standards prohibit the use of the condition operator. Example: 'Object result = (condition) ? foo() : bar();' After the quick-fix is applied: 'Object result;\n if (condition) {\n comp = foo();\n }\n else {\n comp = bar();\n }' Configure the inspection: Use the Ignore for simple assignments and returns option to ignore simple assignments and returns and allow the following constructs: 'String s = (foo == null) ? \"\" : foo.toString();' Use the Ignore places where an if statement is not possible option to ignore conditional expressions in contexts in which automatic replacement with an if statement is not possible (for example, when the conditional expression is used as an argument to a 'super()' constructor call).",
"markdown": "Reports usages of the ternary condition operator and suggests converting them to `if`/`else` statements.\n\nSome code standards prohibit the use of the condition operator.\n\nExample:\n\n\n Object result = (condition) ? foo() : bar();\n\nAfter the quick-fix is applied:\n\n\n Object result;\n if (condition) {\n comp = foo();\n }\n else {\n comp = bar();\n }\n\nConfigure the inspection:\n\nUse the **Ignore for simple assignments and returns** option to ignore simple assignments and returns and allow the following constructs:\n\n\n String s = (foo == null) ? \"\" : foo.toString();\n\n\nUse the **Ignore places where an if statement is not possible** option to ignore conditional expressions in contexts in which automatic\nreplacement with an if statement is not possible (for example, when the conditional expression is used as an argument to a\n`super()` constructor call)."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "ConditionalExpression",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UseOfClone",
"shortDescription": {
"text": "Use of 'clone()' or 'Cloneable'"
},
"fullDescription": {
"text": "Reports implementations of, and calls to, the 'clone()' method and uses of the 'java.lang.Cloneable' interface. Some coding standards prohibit the use of 'clone()', and recommend using a copy constructor or a 'static' factory method instead. The inspection ignores calls to 'clone()' on arrays because it's a correct and compact way to copy an array. Example: 'class Copy implements Cloneable /*warning*/ {\n\n public Copy clone() /*warning*/ {\n try {\n return (Copy) super.clone(); // warning\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }'",
"markdown": "Reports implementations of, and calls to, the `clone()` method and uses of the `java.lang.Cloneable` interface.\n\nSome coding standards prohibit the use of `clone()`, and recommend using a copy constructor or\na `static` factory method instead.\n\nThe inspection ignores calls to `clone()` on arrays because it's a correct and compact way to copy an array.\n\n**Example:**\n\n\n class Copy implements Cloneable /*warning*/ {\n\n public Copy clone() /*warning*/ {\n try {\n return (Copy) super.clone(); // warning\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UseOfClone",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Cloning issues",
"index": 115,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MissingFinalNewline",
"shortDescription": {
"text": "Missing final new line"
},
"fullDescription": {
"text": "Reports if manifest files do not end with a final newline as required by the JAR file specification.",
"markdown": "Reports if manifest files do not end with a final newline as required by the JAR file specification."
},
"defaultConfiguration": {
"enabled": true,
"level": "error",
"parameters": {
"suppressToolId": "MissingFinalNewline",
"ideaSeverity": "ERROR",
"qodanaSeverity": "Critical"
}
},
"relationships": [
{
"target": {
"id": "Manifest",
"index": 116,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NestedTryStatement",
"shortDescription": {
"text": "Nested 'try' statement"
},
"fullDescription": {
"text": "Reports nested 'try' statements. Nested 'try' statements may result in unclear code and should probably have their 'catch' and 'finally' sections merged.",
"markdown": "Reports nested `try` statements.\n\nNested `try` statements\nmay result in unclear code and should probably have their `catch` and `finally` sections\nmerged."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NestedTryStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NonStaticFinalLogger",
"shortDescription": {
"text": "Non-constant logger"
},
"fullDescription": {
"text": "Reports logger fields that are not declared 'static' and/or 'final'. Ensuring that every class logger is effectively constant and bound to that class simplifies the task of providing a unified logging implementation for an application. A quick-fix is provided to change the logger modifiers to 'static final'. Example: 'public class Significant {\n private Logger LOG = Logger.getLogger(Critical.class);\n }' After the quick-fix is applied: 'public class Significant {\n private static final Logger LOG = Logger.getLogger(Critical.class);\n }' Configure the inspection: Use the Logger class name table to specify logger class names. The inspection will report the fields that are not 'static' and 'final' and are of the type equal to one of the specified class names.",
"markdown": "Reports logger fields that are not declared `static` and/or `final`. Ensuring that every class logger is effectively constant and bound to that class simplifies the task of providing a unified logging implementation for an application.\n\nA quick-fix is provided to change the logger modifiers to `static final`.\n\n**Example:**\n\n\n public class Significant {\n private Logger LOG = Logger.getLogger(Critical.class);\n }\n\nAfter the quick-fix is applied:\n\n\n public class Significant {\n private static final Logger LOG = Logger.getLogger(Critical.class);\n }\n\n\nConfigure the inspection:\n\n* Use the **Logger class name** table to specify logger class names. The inspection will report the fields that are not `static` and `final` and are of the type equal to one of the specified class names."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonConstantLogger",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Logging",
"index": 77,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ConditionalExpressionWithIdenticalBranches",
"shortDescription": {
"text": "Conditional expression with identical branches"
},
"fullDescription": {
"text": "Reports conditional expressions with identical 'then' and 'else' branches. Such expressions almost certainly indicate bugs. The inspection provides a fix that collapses conditional expressions. Example: 'int y = x == 10 ? 4 : 4;' After the quick-fix is applied: 'int y = 4;'",
"markdown": "Reports conditional expressions with identical `then` and `else` branches.\n\nSuch expressions almost certainly indicate bugs. The inspection provides a fix that collapses conditional expressions.\n\nExample:\n\n\n int y = x == 10 ? 4 : 4;\n\nAfter the quick-fix is applied:\n\n\n int y = 4;\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ConditionalExpressionWithIdenticalBranches",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OnlyOneElementUsed",
"shortDescription": {
"text": "Only one element is used"
},
"fullDescription": {
"text": "Reports lists, arrays, and strings where exactly one element is queried right upon the creation. Such expressions may appear after refactoring and usually could be replaced with an accessed element. Example: 'System.out.println(new int[] {1,2,3,4,5}[2]);' After the quick-fix is applied: 'System.out.println(3);' New in 2022.3",
"markdown": "Reports lists, arrays, and strings where exactly one element is queried right upon the creation. Such expressions may appear after refactoring and usually could be replaced with an accessed element.\n\nExample:\n\n\n System.out.println(new int[] {1,2,3,4,5}[2]);\n\nAfter the quick-fix is applied:\n\n\n System.out.println(3);\n\nNew in 2022.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "OnlyOneElementUsed",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryBoxing",
"shortDescription": {
"text": "Unnecessary boxing"
},
"fullDescription": {
"text": "Reports explicit boxing, that is wrapping of primitive values in objects. Explicit manual boxing is unnecessary as of Java 5 and later, and can safely be removed. Examples: 'Integer i = new Integer(1);' → 'Integer i = Integer.valueOf(1);' 'int i = Integer.valueOf(1);' → 'int i = 1;' Use the Only report truly superfluously boxed expressions option to report only truly superfluous boxing, where a boxed value is immediately unboxed either implicitly or explicitly. In this case, the entire boxing-unboxing step can be removed. The inspection doesn't report simple explicit boxing. This inspection only reports if the language level of the project or module is 5 or higher.",
"markdown": "Reports explicit boxing, that is wrapping of primitive values in objects.\n\nExplicit manual boxing is unnecessary as of Java 5 and later, and can safely be removed.\n\n**Examples:**\n\n* `Integer i = new Integer(1);` → `Integer i = Integer.valueOf(1);`\n* `int i = Integer.valueOf(1);` → `int i = 1;`\n\n\nUse the **Only report truly superfluously boxed expressions** option to report only truly superfluous boxing,\nwhere a boxed value is immediately unboxed either implicitly or explicitly.\nIn this case, the entire boxing-unboxing step can be removed. The inspection doesn't report simple explicit boxing.\n\nThis inspection only reports if the language level of the project or module is 5 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryBoxing",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 5",
"index": 119,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "BadExceptionThrown",
"shortDescription": {
"text": "Prohibited exception thrown"
},
"fullDescription": {
"text": "Reports 'throw' statements that throw an inappropriate exception. For example an exception can be inappropriate because it is overly generic, such as 'java.lang.Exception' or 'java.io.IOException'. Example: 'void setup(Mode mode) {\n if (mode == null)\n throw new RuntimeException(\"Problem during setup\"); // warning: Prohibited exception 'RuntimeException' thrown\n ...\n }' Use the Prohibited exceptions list to specify which exceptions should be reported.",
"markdown": "Reports `throw` statements that throw an inappropriate exception. For example an exception can be inappropriate because it is overly generic, such as `java.lang.Exception` or `java.io.IOException`.\n\n**Example:**\n\n\n void setup(Mode mode) {\n if (mode == null)\n throw new RuntimeException(\"Problem during setup\"); // warning: Prohibited exception 'RuntimeException' thrown\n ...\n }\n\nUse the **Prohibited exceptions** list to specify which exceptions should be reported."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ProhibitedExceptionThrown",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Anonymous2MethodRef",
"shortDescription": {
"text": "Anonymous type can be replaced with method reference"
},
"fullDescription": {
"text": "Reports anonymous classes which can be replaced with method references. Note that if an anonymous class is converted into an unbound method reference, the same method reference object can be reused by the Java runtime during subsequent invocations. On the other hand, when an anonymous class is used, separate objects are created every time. Thus, applying the quick-fix can cause the semantics change in rare cases, e.g. when anonymous class instances are used as 'HashMap' keys. Example: 'Runnable r = new Runnable() {\n @Override\n public void run() {\n System.out.println();\n }\n };' The quick-fix changes this code to the compact form: 'Runnable r = System.out::println;'. Use the Report when interface is not annotated with @FunctionalInterface option to enable this inspection for interfaces which are not annotated with @FunctionalInterface. This inspection only reports if the language level of the project or module is 8 or higher.",
"markdown": "Reports anonymous classes which can be replaced with method references.\n\n\nNote that if an anonymous class is converted into an unbound method reference, the same method reference object\ncan be reused by the Java runtime during subsequent invocations. On the other hand, when an anonymous class is used,\nseparate objects are created every time. Thus, applying the quick-fix can cause the semantics change in rare cases,\ne.g. when anonymous class instances are used as `HashMap` keys.\n\n**Example:**\n\n\n Runnable r = new Runnable() {\n @Override\n public void run() {\n System.out.println();\n }\n };\n\nThe quick-fix changes this code to the compact form: `Runnable r = System.out::println;`.\n\nUse the **Report when interface is not annotated with @FunctionalInterface** option to enable this inspection for\ninterfaces which are not annotated with @FunctionalInterface.\n\nThis inspection only reports if the language level of the project or module is 8 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "Anonymous2MethodRef",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 8",
"index": 120,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PublicMethodNotExposedInInterface",
"shortDescription": {
"text": "'public' method not exposed in interface"
},
"fullDescription": {
"text": "Reports 'public' methods in classes which are not exposed in an interface. Exposing all 'public' methods via an interface is important for maintaining loose coupling, and may be necessary for certain component-based programming styles. Example: 'interface Person {\n String getName();\n}\n\nclass PersonImpl implements Person {\n private String name;\n\n // ok: method is exposed in interface\n @Override\n public String getName() {\n return name;\n }\n\n // warning: method is public\n // but not exposed in interface\n public void setName() {\n this.name = name;\n }\n}' Use the Ignore if annotated by list to specify special annotations. Methods annotated with one of these annotations will be ignored by this inspection. Use the Ignore if the containing class does not implement a non-library interface option to ignore methods from classes which do not implement any interface from the project.",
"markdown": "Reports `public` methods in classes which are not exposed in an interface.\n\nExposing all `public` methods via an interface is important for\nmaintaining loose coupling, and may be necessary for certain component-based programming styles.\n\nExample:\n\n\n interface Person {\n String getName();\n }\n\n class PersonImpl implements Person {\n private String name;\n\n // ok: method is exposed in interface\n @Override\n public String getName() {\n return name;\n }\n\n // warning: method is public\n // but not exposed in interface\n public void setName() {\n this.name = name;\n }\n }\n\n\nUse the **Ignore if annotated by** list to specify special annotations. Methods annotated with one of\nthese annotations will be ignored by this inspection.\n\n\nUse the **Ignore if the containing class does not implement a non-library interface** option to ignore methods from classes which do not\nimplement any interface from the project."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "PublicMethodNotExposedInInterface",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Abstraction issues",
"index": 86,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SerializableHasSerialVersionUIDField",
"shortDescription": {
"text": "Serializable class without 'serialVersionUID'"
},
"fullDescription": {
"text": "Reports classes that implement 'Serializable' and do not declare a 'serialVersionUID' field. Without a 'serialVersionUID' field, any change to the class will make previously serialized versions unreadable. Example: 'class Main implements Serializable {\n }' After the quick-fix is applied: 'class Main implements Serializable {\n private static final long serialVersionUID = -1446398935944895849L;\n }' When using a language level of JDK 14 or higher, the quickfix will also add the 'java.io.Serial' annotation. Use the following options to configure the inspection: List classes whose inheritors should not be reported by this inspection. This is meant for classes that inherit 'Serializable' from a superclass but are not intended for serialization. Whether to ignore 'Serializable' anonymous classes.",
"markdown": "Reports classes that implement `Serializable` and do not declare a `serialVersionUID` field.\n\n\nWithout a `serialVersionUID` field, any change to the class will make previously serialized versions unreadable.\n\n**Example:**\n\n\n class Main implements Serializable {\n }\n\nAfter the quick-fix is applied:\n\n\n class Main implements Serializable {\n private static final long serialVersionUID = -1446398935944895849L;\n }\n\nWhen using a language level of JDK 14 or higher, the quickfix will also add the `java.io.Serial` annotation.\n\nUse the following options to configure the inspection:\n\n* List classes whose inheritors should not be reported by this inspection. This is meant for classes that inherit `Serializable` from a superclass but are not intended for serialization.\n* Whether to ignore `Serializable` anonymous classes."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "serial",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages",
"index": 1,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TestCaseWithNoTestMethods",
"shortDescription": {
"text": "Test class without tests"
},
"fullDescription": {
"text": "Reports non-'abstract' test cases without any test methods. Such test cases usually indicate unfinished code or could be a refactoring leftover that should be removed. Example: 'public class CrucialTest {\n @Before\n public void setUp() {\n System.out.println(\"setting up\");\n }\n }' Use the Ignore test cases which have superclasses with test methods option to ignore test cases which have super classes with test methods.",
"markdown": "Reports non-`abstract` test cases without any test methods. Such test cases usually indicate unfinished code or could be a refactoring leftover that should be removed.\n\nExample:\n\n\n public class CrucialTest {\n @Before\n public void setUp() {\n System.out.println(\"setting up\");\n }\n }\n\n\nUse the **Ignore test cases which have superclasses with test methods** option to ignore test cases which have super classes\nwith test methods."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "JUnitTestCaseWithNoTests",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Test frameworks",
"index": 121,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MismatchedArrayReadWrite",
"shortDescription": {
"text": "Mismatched read and write of array"
},
"fullDescription": {
"text": "Reports arrays whose contents are read but not updated, or updated but not read. Such inconsistent reads and writes are pointless and probably indicate dead, incomplete or erroneous code. Example: 'final int[] bar = new int[3];\n bar[2] = 3;'",
"markdown": "Reports arrays whose contents are read but not updated, or updated but not read. Such inconsistent reads and writes are pointless and probably indicate dead, incomplete or erroneous code.\n\n**Example:**\n\n\n final int[] bar = new int[3];\n bar[2] = 3;\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "MismatchedReadAndWriteOfArray",
"cweIds": [
561,
563
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessarilyQualifiedStaticUsage",
"shortDescription": {
"text": "Unnecessarily qualified static access"
},
"fullDescription": {
"text": "Reports usages of static members qualified with the class name. Such qualification is unnecessary and may be safely removed. Example: 'class Foo {\n static void foo() {}\n static int x;\n\n void bar() {\n Foo.foo();\n System.out.println(Foo.x);\n }\n\n static void baz() { Foo.foo(); }\n }' After the quick-fix is applied: 'class Foo {\n static void foo() {}\n static int x;\n\n void bar() {\n foo();\n System.out.println(x);\n }\n\n static void baz() { foo(); }\n }' Use the inspection options to toggle the reporting for: Static fields access: 'void bar() { System.out.println(Foo.x); }' Calls to static methods: 'void bar() { Foo.foo(); }' Also, you can configure the inspection to only report static member usage in a static context. In this case, only 'static void baz() { Foo.foo(); }' will be reported.",
"markdown": "Reports usages of static members qualified with the class name.\n\n\nSuch qualification is unnecessary and may be safely removed.\n\n**Example:**\n\n\n class Foo {\n static void foo() {}\n static int x;\n\n void bar() {\n Foo.foo();\n System.out.println(Foo.x);\n }\n\n static void baz() { Foo.foo(); }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n static void foo() {}\n static int x;\n\n void bar() {\n foo();\n System.out.println(x);\n }\n\n static void baz() { foo(); }\n }\n\n\nUse the inspection options to toggle the reporting for:\n\n* Static fields access: \n `void bar() { System.out.println(Foo.x); }`\n\n* Calls to static methods: \n `void bar() { Foo.foo(); }`\n\n\nAlso, you can configure the inspection to only report static member usage\nin a static context. In this case, only `static void baz() { Foo.foo(); }` will be reported."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessarilyQualifiedStaticUsage",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SystemGetProperty",
"shortDescription": {
"text": "Call to 'System.getProperty(str)' could be simplified"
},
"fullDescription": {
"text": "Reports the usage of method 'System.getProperty(str)' and suggests a fix in 2 cases: 'System.getProperty(\"path.separator\")' -> 'File.pathSeparator' 'System.getProperty(\"line.separator\")' -> 'System.lineSeparator()' The second one is not only less error-prone but is likely to be faster, as 'System.lineSeparator()' returns cached value, while 'System.getProperty(\"line.separator\")' each time calls to Properties (Hashtable or CHM depending on implementation).",
"markdown": "Reports the usage of method `System.getProperty(str)` and suggests a fix in 2 cases:\n\n* `System.getProperty(\"path.separator\")` -\\> `File.pathSeparator`\n* `System.getProperty(\"line.separator\")` -\\> `System.lineSeparator()`\n\nThe second one is not only less error-prone but is likely to be faster, as `System.lineSeparator()` returns cached value, while `System.getProperty(\"line.separator\")` each time calls to Properties (Hashtable or CHM depending on implementation)."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SystemGetProperty",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages",
"index": 1,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CollectionsMustHaveInitialCapacity",
"shortDescription": {
"text": "Collection without initial capacity"
},
"fullDescription": {
"text": "Reports attempts to instantiate a new 'Collection' object without specifying an initial capacity. If no initial capacity is specified, a default capacity is used, which will rarely be optimal. Failing to specify initial capacities for collections may result in performance issues if space needs to be reallocated and memory copied when the initial capacity is exceeded. This inspection checks allocations of classes listed in the inspection's settings. Example: 'new HashMap<String, String>();' Use the following options to configure the inspection: List collection classes that should be checked. Whether to ignore field initializers.",
"markdown": "Reports attempts to instantiate a new `Collection` object without specifying an initial capacity.\n\n\nIf no initial capacity is specified, a default capacity is used, which will rarely be optimal. Failing\nto specify initial capacities for collections may result in performance issues if space needs to be reallocated and\nmemory copied when the initial capacity is exceeded.\nThis inspection checks allocations of classes listed in the inspection's settings.\n\n**Example:**\n\n\n new HashMap<String, String>();\n\nUse the following options to configure the inspection:\n\n* List collection classes that should be checked.\n* Whether to ignore field initializers."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CollectionWithoutInitialCapacity",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassOnlyUsedInOneModule",
"shortDescription": {
"text": "Class only used from one other module"
},
"fullDescription": {
"text": "Reports classes that: do not depend on any other class in their module depend on classes from a different module are a dependency only for classes from this other module Such classes could be moved into the module on which they depend. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.",
"markdown": "Reports classes that:\n\n* do not depend on any other class in their module\n* depend on classes from a different module\n* are a dependency only for classes from this other module\n\nSuch classes could be moved into the module on which they depend.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassOnlyUsedInOneModule",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Modularization issues",
"index": 78,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TryStatementWithMultipleResources",
"shortDescription": {
"text": "'try' statement with multiple resources can be split"
},
"fullDescription": {
"text": "Reports 'try' statements with multiple resources that can be automatically split into multiple try-with-resources statements. This conversion can be useful for further refactoring (for example, for extracting the nested 'try' statement into a separate method). Example: 'try (FileInputStream in = new FileInputStream(\"in.txt\");\n FileOutputStream out = new FileOutputStream(\"out.txt\")) {\n /*read and write*/\n }' After the quick-fix is applied: 'try (FileInputStream in = new FileInputStream(\"in.txt\")) {\n try (FileOutputStream out = new FileOutputStream(\"out.txt\")) {\n /*read and write*/\n }\n }'",
"markdown": "Reports `try` statements with multiple resources that can be automatically split into multiple try-with-resources statements.\n\nThis conversion can be useful for further refactoring\n(for example, for extracting the nested `try` statement into a separate method).\n\nExample:\n\n\n try (FileInputStream in = new FileInputStream(\"in.txt\");\n FileOutputStream out = new FileOutputStream(\"out.txt\")) {\n /*read and write*/\n }\n\nAfter the quick-fix is applied:\n\n\n try (FileInputStream in = new FileInputStream(\"in.txt\")) {\n try (FileOutputStream out = new FileOutputStream(\"out.txt\")) {\n /*read and write*/\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "TryStatementWithMultipleResources",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TypeMayBeWeakened",
"shortDescription": {
"text": "Type may be weakened"
},
"fullDescription": {
"text": "Reports variable and method return types that can be changed to a more abstract (weaker) type. This allows making the code more abstract, hence more reusable. Example: '// Type of parameter can be weakened to java.util.List\n void processList(ArrayList<String> list) {\n if (list.isEmpty()) return;\n System.out.println(\"Processing\");\n for (String s : list) {\n System.out.println(\"String: \" + s);\n }\n }' Enable the Only weaken to an interface checkbox below to only report a problem when the type can be weakened to an interface type. Enable the Do not suggest weakening variable declared as 'var' checkbox below to prevent reporting on local variables declared using the 'var' keyword (Java 10+) Stop classes are intended to prevent weakening to classes lower than stop classes, even if it is possible. In some cases, this may improve readability.",
"markdown": "Reports variable and method return types that can be changed to a more abstract (weaker) type. This allows making the code more abstract, hence more reusable.\n\nExample:\n\n\n // Type of parameter can be weakened to java.util.List\n void processList(ArrayList<String> list) {\n if (list.isEmpty()) return;\n System.out.println(\"Processing\");\n for (String s : list) {\n System.out.println(\"String: \" + s);\n }\n }\n\n\nEnable the **Only weaken to an interface** checkbox below\nto only report a problem when the type can be weakened to an interface type.\n\n\nEnable the **Do not suggest weakening variable declared as 'var'** checkbox below\nto prevent reporting on local variables declared using the 'var' keyword (Java 10+)\n\n\n**Stop classes** are intended to prevent weakening to classes\nlower than stop classes, even if it is possible.\nIn some cases, this may improve readability."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "TypeMayBeWeakened",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Abstraction issues",
"index": 86,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CloneableImplementsClone",
"shortDescription": {
"text": "Cloneable class without 'clone()' method"
},
"fullDescription": {
"text": "Reports classes implementing the 'Cloneable' interface that don't override the 'clone()' method. Such classes use the default implementation of 'clone()', which isn't 'public' but 'protected', and which does not copy the mutable state of the class. A quick-fix is available to generate a basic 'clone()' method, which can be used as a basis for a properly functioning 'clone()' method expected from a 'Cloneable' class. Example: 'public class Data implements Cloneable {\n private String[] names;\n }' After the quick-fix is applied: 'public class Data implements Cloneable {\n private String[] names;\n\n @Override\n public Data clone() {\n try {\n Data clone = (Data) super.clone();\n // TODO: copy mutable state here, so the clone can't change the internals of the original\n return clone;\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }' Use the Ignore classes cloneable due to inheritance option to ignore classes that are 'Cloneable' because they inherit from the 'Cloneable' class. Use the Ignore when Cloneable is necessary to call clone() method of super class option to ignore classes that require implementing 'Cloneable' because they call the 'clone()' method from a superclass.",
"markdown": "Reports classes implementing the `Cloneable` interface that don't override the `clone()` method.\n\nSuch classes use the default implementation of `clone()`,\nwhich isn't `public` but `protected`, and which does not copy the mutable state of the class.\n\nA quick-fix is available to generate a basic `clone()` method,\nwhich can be used as a basis for a properly functioning `clone()` method\nexpected from a `Cloneable` class.\n\n**Example:**\n\n\n public class Data implements Cloneable {\n private String[] names;\n }\n\nAfter the quick-fix is applied:\n\n\n public class Data implements Cloneable {\n private String[] names;\n\n @Override\n public Data clone() {\n try {\n Data clone = (Data) super.clone();\n // TODO: copy mutable state here, so the clone can't change the internals of the original\n return clone;\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }\n\nUse the **Ignore classes cloneable due to inheritance** option to ignore classes that are\n`Cloneable` because they inherit from the `Cloneable` class.\n\nUse the **Ignore when Cloneable is necessary to call clone() method of super class**\noption to ignore classes that require implementing `Cloneable` because they call the `clone()` method from a superclass."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "CloneableClassWithoutClone",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Cloning issues",
"index": 115,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OctalAndDecimalIntegersMixed",
"shortDescription": {
"text": "Octal and decimal integers in same array"
},
"fullDescription": {
"text": "Reports mixed octal and decimal integer literals in a single array initializer. This situation might happen when you copy a list of numbers into an array initializer. Some numbers in the array might be zero-padded and the compiler will interpret them as octal. Example: 'int[] elapsed = {1, 13, 052};' After the quick-fix that removes a leading zero is applied: 'int[] elapsed = {1, 13, 52};' If it is an octal number (for example, after a variable inline), then you can use another quick-fix that converts octal to decimal: 'int[] elapsed = {1, 13, 42};'",
"markdown": "Reports mixed octal and decimal integer literals in a single array initializer. This situation might happen when you copy a list of numbers into an array initializer. Some numbers in the array might be zero-padded and the compiler will interpret them as octal.\n\n**Example:**\n\n int[] elapsed = {1, 13, 052};\n\nAfter the quick-fix that removes a leading zero is applied:\n\n int[] elapsed = {1, 13, 52};\n\nIf it is an octal number (for example, after a variable inline), then you can use another quick-fix that converts octal to decimal:\n`int[] elapsed = {1, 13, 42};`"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OctalAndDecimalIntegersInSameArray",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Deprecation",
"shortDescription": {
"text": "Deprecated API usage"
},
"fullDescription": {
"text": "Reports usages of deprecated classes, fields, and methods. A quick-fix is available to automatically convert the deprecated usage, when the necessary information can be extracted from the Javadoc of the deprecated member. Example: 'class Interesting {\n\n /**\n * @deprecated Use {@link #newHotness()} instead\n */\n @Deprecated\n public void oldAndBusted() {}\n\n public void newHotness() {}\n }\n class ElseWhere {\n void x(Interesting i) {\n i.oldAndBusted(); // deprecated warning here\n }\n }' After the quick-fix is applied: 'class Interesting {\n\n /**\n * @deprecated Use {@link #newHotness()} instead\n */\n @Deprecated\n public void oldAndBusted() {}\n\n public void newHotness() {}\n }\n class ElseWhere {\n void x(Interesting i) {\n i.newHotness();\n }\n }' By default, the inspection doesn't produce a warning if it's impossible or hard to avoid it. For example, the following code won't be reported: 'abstract class A { //library code\n @Deprecated\n abstract void m();\n }\n class B extends A { //project code\n @Override\n void m() {\n //doSmth;\n }\n }' Configure the inspection: Use the options to disable this inspection inside deprecated members, overrides of abstract deprecated methods, non-static import statements, methods of deprecated classes, or same top-level classes.",
"markdown": "Reports usages of deprecated classes, fields, and methods. A quick-fix is available to automatically convert the deprecated usage, when the necessary information can be extracted from the Javadoc of the deprecated member.\n\n**Example:**\n\n\n class Interesting {\n\n /**\n * @deprecated Use {@link #newHotness()} instead\n */\n @Deprecated\n public void oldAndBusted() {}\n\n public void newHotness() {}\n }\n class ElseWhere {\n void x(Interesting i) {\n i.oldAndBusted(); // deprecated warning here\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Interesting {\n\n /**\n * @deprecated Use {@link #newHotness()} instead\n */\n @Deprecated\n public void oldAndBusted() {}\n\n public void newHotness() {}\n }\n class ElseWhere {\n void x(Interesting i) {\n i.newHotness();\n }\n }\n\nBy default, the inspection doesn't produce a warning if it's impossible or hard to avoid it. For example,\nthe following code won't be reported:\n\n\n abstract class A { //library code\n @Deprecated\n abstract void m();\n }\n class B extends A { //project code\n @Override\n void m() {\n //doSmth;\n }\n }\n\nConfigure the inspection:\n\n\nUse the options to disable this inspection inside deprecated members,\noverrides of abstract deprecated methods, non-static import statements, methods of deprecated classes, or same top-level classes."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "deprecation",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code maturity",
"index": 56,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ConditionSignal",
"shortDescription": {
"text": "Call to 'signal()' instead of 'signalAll()'"
},
"fullDescription": {
"text": "Reports calls to 'java.util.concurrent.locks.Condition.signal()'. While occasionally useful, in almost all cases 'signalAll()' is a better and safer choice.",
"markdown": "Reports calls to `java.util.concurrent.locks.Condition.signal()`. While occasionally useful, in almost all cases `signalAll()` is a better and safer choice."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CallToSignalInsteadOfSignalAll",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PublicMethodWithoutLogging",
"shortDescription": {
"text": "'public' method without logging"
},
"fullDescription": {
"text": "Reports any public methods that do not contain a logging statement. This inspection does not report simple getters and setters. For example: 'public class Crucial {\n private static final Logger LOG = LoggerFactory.getLogger(Crucial.class);\n public void doImportantStuff() {\n // warning on this method\n }\n\n public void doOtherStuff() {\n LOG.info(\"do other stuff\");\n }\n }' Use the table below to specify Logger class names. Public methods that do not use instance methods of the specified classes will be reported by this inspection.",
"markdown": "Reports any public methods that do not contain a logging statement. This inspection does not report simple getters and setters.\n\nFor example:\n\n\n public class Crucial {\n private static finalLogger LOG = LoggerFactory.getLogger(Crucial.class);\n public void doImportantStuff() {\n // warning on this method\n }\n\n public void doOtherStuff() {\n LOG.info(\"do other stuff\");\n }\n }\n\n\nUse the table below to specify Logger class names.\nPublic methods that do not use instance methods of the specified classes will be reported by this inspection."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "PublicMethodWithoutLogging",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Logging",
"index": 77,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassNestingDepth",
"shortDescription": {
"text": "Inner class too deeply nested"
},
"fullDescription": {
"text": "Reports classes whose number of nested inner classes exceeds the specified maximum. Nesting inner classes inside other inner classes is confusing and indicates that a refactoring may be necessary. Use the Nesting limit field to specify the maximum allowed nesting depth for a class.",
"markdown": "Reports classes whose number of nested inner classes exceeds the specified maximum.\n\nNesting inner classes inside other inner classes is confusing and indicates that a refactoring may be necessary.\n\nUse the **Nesting limit** field to specify the maximum allowed nesting depth for a class."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "InnerClassTooDeeplyNested",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class metrics",
"index": 123,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LambdaParameterTypeCanBeSpecified",
"shortDescription": {
"text": "Lambda parameter type can be specified"
},
"fullDescription": {
"text": "Reports lambda parameters that do not have their type specified and suggests adding the missing type declarations. Example: 'Function<String, Integer> length = a -> a.length();' After the quick-fix is applied: 'Function<String, Integer> length = (String a) -> a.length();' This inspection only reports if the language level of the project or module is 8 or higher.",
"markdown": "Reports lambda parameters that do not have their type specified and suggests adding the missing type declarations.\n\nExample:\n\n\n Function<String, Integer> length = a -> a.length();\n\nAfter the quick-fix is applied:\n\n\n Function<String, Integer> length = (String a) -> a.length();\n\nThis inspection only reports if the language level of the project or module is 8 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "LambdaParameterTypeCanBeSpecified",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TextLabelInSwitchStatement",
"shortDescription": {
"text": "Text label in 'switch' statement"
},
"fullDescription": {
"text": "Reports labeled statements inside of 'switch' statements. While occasionally intended, this construction is often the result of a typo. Example: 'switch (x) {\n case 1:\n case2: //warning: Text label 'case2:' in 'switch' statement\n case 3:\n break;\n }'",
"markdown": "Reports labeled statements inside of `switch` statements. While occasionally intended, this construction is often the result of a typo.\n\n**Example:**\n\n\n switch (x) {\n case 1:\n case2: //warning: Text label 'case2:' in 'switch' statement\n case 3:\n break;\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "TextLabelInSwitchStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PackageVisibleInnerClass",
"shortDescription": {
"text": "Package-visible nested class"
},
"fullDescription": {
"text": "Reports nested classes that are declared without any access modifier (also known as package-private). Example: 'public class Outer {\n static class Nested {} // warning\n class Inner {} // warning\n enum Mode {} // warning depends on the setting\n interface I {} // warning depends on the setting\n }' Configure the inspection: Use the Ignore package-visible inner enums option to ignore package-private inner enums. Use the Ignore package-visible inner interfaces option to ignore package-private inner interfaces.",
"markdown": "Reports nested classes that are declared without any access modifier (also known as package-private).\n\n**Example:**\n\n\n public class Outer {\n static class Nested {} // warning\n class Inner {} // warning\n enum Mode {} // warning depends on the setting\n interface I {} // warning depends on the setting\n }\n\nConfigure the inspection:\n\n* Use the **Ignore package-visible inner enums** option to ignore package-private inner enums.\n* Use the **Ignore package-visible inner interfaces** option to ignore package-private inner interfaces."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "PackageVisibleInnerClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Encapsulation",
"index": 125,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryUnaryMinus",
"shortDescription": {
"text": "Unnecessary unary minus"
},
"fullDescription": {
"text": "Reports unnecessary unary minuses. Such expressions might be hard to understand and might contain errors. For example: 'void unaryMinus(int i) {\n int x = - -i;\n }' The following quick fixes are suggested here: Remove '-' operators before the 'i' variable: 'void unaryMinus(int i) {\n int x = i;\n }' Replace '-' operators with the prefix decrement operator: 'void unaryMinus(int i) {\n int x = --i;\n }' Another example: 'void unaryMinus(int i) {\n i += - 8;\n }' After the quick-fix is applied: 'void unaryMinus(int i) {\n i -= 8;\n }'",
"markdown": "Reports unnecessary unary minuses. Such expressions might be hard to understand and might contain errors.\n\n**For example:**\n\n void unaryMinus(int i) {\n int x = - -i;\n }\n\nThe following quick fixes are suggested here:\n\n* Remove `-` operators before the `i` variable:\n\n void unaryMinus(int i) {\n int x = i;\n }\n\n* Replace `-` operators with the prefix decrement operator:\n\n void unaryMinus(int i) {\n int x = --i;\n }\n\n**Another example:**\n\n void unaryMinus(int i) {\n i += - 8;\n }\n\nAfter the quick-fix is applied:\n\n void unaryMinus(int i) {\n i -= 8;\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryUnaryMinus",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MethodMayBeStatic",
"shortDescription": {
"text": "Method can be made 'static'"
},
"fullDescription": {
"text": "Reports methods that can safely be made 'static'. Making methods static when possible can reduce memory consumption and improve your code quality. A method can be 'static' if: it is not 'synchronized', 'native' or 'abstract', does not reference any of non-static methods and non-static fields from the containing class, is not an override and is not overridden in a subclass. Use the following options to configure the inspection: Whether to report only 'private' and 'final' methods, which increases the performance of this inspection. Whether to ignore empty methods. Whether to ignore default methods in interface when using Java 8 or higher. Whether to let the quick-fix replace instance qualifiers with class references in calls to methods which are made 'static', that is, call 'myClass.m()' would be replaced with 'MyClass.m()'.",
"markdown": "Reports methods that can safely be made `static`. Making methods static when possible can reduce memory consumption and improve your code quality.\n\nA method can be `static` if:\n\n* it is not `synchronized`, `native` or `abstract`,\n* does not reference any of non-static methods and non-static fields from the containing class,\n* is not an override and is not overridden in a subclass.\n\nUse the following options to configure the inspection:\n\n* Whether to report only `private` and `final` methods, which increases the performance of this inspection.\n* Whether to ignore empty methods.\n* Whether to ignore default methods in interface when using Java 8 or higher.\n* Whether to let the quick-fix replace instance qualifiers with class references in calls to methods which are made `static`, that is, call `myClass.m()` would be replaced with `MyClass.m()`."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "MethodMayBeStatic",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TestMethodWithoutAssertion",
"shortDescription": {
"text": "Test method without assertions"
},
"fullDescription": {
"text": "Reports test methods that do not contain any assertions. Such methods may indicate either incomplete or weak test cases. Example: 'public class ExtensiveTest {\n\n @Test\n public void testAlive() {\n System.out.println(\"nothing\");\n }\n }' Configure the inspection: Use the table to specify the combinations of fully qualified class name and method name regular expression that should qualify as assertions. Class names also match subclasses. Use the 'assert' keyword is considered an assertion option to specify if the Java 'assert' statements using the 'assert' keyword should be considered an assertion. Use the Ignore test methods which declare exceptions option to ignore the test methods that declare exceptions. This can be useful when you have tests that will throw an exception on failure and thus don't need any assertions.",
"markdown": "Reports test methods that do not contain any assertions. Such methods may indicate either incomplete or weak test cases.\n\n**Example:**\n\n\n public class ExtensiveTest {\n\n @Test\n public void testAlive() {\n System.out.println(\"nothing\");\n }\n }\n\n\nConfigure the inspection:\n\n* Use the table to specify the combinations of fully qualified class name and method name regular expression that should qualify as assertions. Class names also match subclasses.\n* Use the **'assert' keyword is considered an assertion** option to specify if the Java `assert` statements using the `assert` keyword should be considered an assertion.\n* Use the **Ignore test methods which declare exceptions** option to ignore the test methods that declare exceptions. This can be useful when you have tests that will throw an exception on failure and thus don't need any assertions."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "TestMethodWithoutAssertion",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Test frameworks",
"index": 121,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JUnitMixedFramework",
"shortDescription": {
"text": "JUnit API usage from multiple versions in a single TestCase"
},
"fullDescription": {
"text": "Reports JUnit annotated methods when used in a test case from a different JUnit version. To determine the framework version for a test case the inspection checks the framework version of the super class when available. When a super class is not available it will use the most used framework in the test case. Example (JUnit 4 annotation in JUnit 3 test case): 'public class MyTest extends TestCase {\n @Test\n public void foo() { }\n\n @Test\n @Ignore\n public void testBar() { }\n }' After the quick-fix is applied: 'public class MyTest extends TestCase {\n public void testFoo() {}\n\n public void _testBar() {}\n }' Example (JUnit 5 annotation in JUnit 4 test case): 'public class MyTest {\n @BeforeAll // JUnit 5 lifecycle method\n public void initialize() { }\n\n @org.junit.Test // JUnit 4 test annotation\n public void test() {}\n\n @org.junit.Test // JUnit 4 test annotation\n public void testWouldBeExecuted() {}\n }' After the quick-fix is applied: 'public class MyTest {\n @BeforeClass // JUnit 4 lifecycle method\n public void initialize() { }\n\n @org.junit.Test // JUnit 4 test annotation\n public void test() {}\n\n @org.junit.Test // JUnit 4 test annotation\n public void testWouldBeExecuted() {}\n }'",
"markdown": "Reports JUnit annotated methods when used in a test case from a different JUnit version. To determine the framework version for a test case the inspection checks the framework version of the super class when available. When a super class is not available it will use the most used framework in the test case.\n\nExample (JUnit 4 annotation in JUnit 3 test case):\n\n\n public class MyTest extends TestCase {\n @Test\n public void foo() { }\n\n @Test\n @Ignore\n public void testBar() { }\n }\n\nAfter the quick-fix is applied:\n\n\n public class MyTest extends TestCase {\n public void testFoo() {}\n\n public void _testBar() {}\n }\n\nExample (JUnit 5 annotation in JUnit 4 test case):\n\n\n public class MyTest {\n @BeforeAll // JUnit 5 lifecycle method\n public void initialize() { }\n\n @org.junit.Test // JUnit 4 test annotation\n public void test() {}\n\n @org.junit.Test // JUnit 4 test annotation\n public void testWouldBeExecuted() {}\n }\n\nAfter the quick-fix is applied:\n\n\n public class MyTest {\n @BeforeClass // JUnit 4 lifecycle method\n public void initialize() { }\n\n @org.junit.Test // JUnit 4 test annotation\n public void test() {}\n\n @org.junit.Test // JUnit 4 test annotation\n public void testWouldBeExecuted() {}\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "JUnitMixedFramework",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Test frameworks",
"index": 121,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "EscapedSpace",
"shortDescription": {
"text": "Non-terminal use of '\\s' escape sequence"
},
"fullDescription": {
"text": "Reports '\\s' escape sequences anywhere except at text-block line endings or within a series of several escaped spaces. Such usages can be confusing or a mistake, especially if the string is interpreted as a regular expression. The '\\s' escape sequence is intended to encode a space at the end of text-block lines where normal spaces are trimmed. In other locations, as well as in regular string or char literals, '\\s' is identical to an ordinary space character ('\" \"'). Example: 'if (str.matches(\"\\s+\")) {...}' Here it's likely that '\"\\\\s+\"' was intended (to match any whitespace character). If not, using 'str.matches(\" +\")' would be less confusing. A quick-fix is provided that replaces '\\s' escapes with space characters. This inspection reports only if the language level of the project or module is 15 or higher. New in 2022.3",
"markdown": "Reports `\\s` escape sequences anywhere except at text-block line endings or within a series of several escaped spaces. Such usages can be confusing or a mistake, especially if the string is interpreted as a regular expression. The `\\s` escape sequence is intended to encode a space at the end of text-block lines where normal spaces are trimmed. In other locations, as well as in regular string or char literals, `\\s` is identical to an ordinary space character (`\" \"`).\n\n**Example:**\n\n\n if (str.matches(\"\\s+\")) {...}\n\nHere it's likely that `\"\\\\s+\"` was intended (to match any whitespace character). If not, using `str.matches(\" +\")` would be less confusing.\n\n\nA quick-fix is provided that replaces `\\s` escapes with space characters.\n\nThis inspection reports only if the language level of the project or module is 15 or higher.\n\nNew in 2022.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "EscapedSpace",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ContinueStatement",
"shortDescription": {
"text": "'continue' statement"
},
"fullDescription": {
"text": "Reports 'continue' statements. 'continue' statements complicate refactoring and can be confusing. Example: 'void foo(List<String> strs) {\n for (String str : strs) {\n if (str.contains(\"skip\")) continue;\n handleStr(str);\n }\n }'",
"markdown": "Reports `continue` statements.\n\n`continue` statements complicate refactoring and can be confusing.\n\nExample:\n\n\n void foo(List<String> strs) {\n for (String str : strs) {\n if (str.contains(\"skip\")) continue;\n handleStr(str);\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ContinueStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MisorderedAssertEqualsArguments",
"shortDescription": {
"text": "Misordered 'assertEquals()' arguments"
},
"fullDescription": {
"text": "Reports calls to 'assertEquals()' that have the expected argument and the actual argument in the wrong order. For JUnit 3, 4, and 5 the correct order is '(expected, actual)'. For TestNG the correct order is '(actual, expected)'. Such calls will behave fine for assertions that pass, but may give confusing error reports on failure. Use the quick-fix to flip the order of the arguments. Example (JUnit): 'assertEquals(actual, expected)' After the quick-fix is applied: 'assertEquals(expected, actual)'",
"markdown": "Reports calls to `assertEquals()` that have the expected argument and the actual argument in the wrong order.\n\n\nFor JUnit 3, 4, and 5 the correct order is `(expected, actual)`.\nFor TestNG the correct order is `(actual, expected)`.\n\n\nSuch calls will behave fine for assertions that pass, but may give confusing error reports on failure.\nUse the quick-fix to flip the order of the arguments.\n\n**Example (JUnit):**\n\n\n assertEquals(actual, expected)\n\nAfter the quick-fix is applied:\n\n\n assertEquals(expected, actual)\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "MisorderedAssertEqualsArguments",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Test frameworks",
"index": 127,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StaticVariableInitialization",
"shortDescription": {
"text": "Static field may not be initialized"
},
"fullDescription": {
"text": "Reports 'static' variables that may be uninitialized upon class initialization. Example: 'class Foo {\n public static int bar;\n\n static { }\n }' Note that this inspection uses a very conservative dataflow algorithm and may incorrectly report 'static' variables as uninitialized. Variables reported as initialized will always be initialized. Use the Ignore primitive fields option to ignore uninitialized primitive fields.",
"markdown": "Reports `static` variables that may be uninitialized upon class initialization.\n\n**Example:**\n\n\n class Foo {\n public static int bar;\n\n static { }\n }\n\nNote that this inspection uses a very conservative dataflow algorithm and may incorrectly report `static` variables as uninitialized. Variables\nreported as initialized will always be initialized.\n\nUse the **Ignore primitive fields** option to ignore uninitialized primitive fields."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "StaticVariableMayNotBeInitialized",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Initialization",
"index": 33,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ConstantAssertCondition",
"shortDescription": {
"text": "Constant condition in 'assert' statement"
},
"fullDescription": {
"text": "Reports 'assert' statement conditions that are constants. 'assert' statements with constant conditions will either always fail or always succeed. Such statements might be left over after a refactoring and are probably not intended. Example: 'void foo() {\n assert true;\n }'",
"markdown": "Reports `assert` statement conditions that are constants. `assert` statements with constant conditions will either always fail or always succeed. Such statements might be left over after a refactoring and are probably not intended.\n\n**Example:**\n\n\n void foo() {\n assert true;\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ConstantAssertCondition",
"cweIds": [
570,
571
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaReflectionInvocation",
"shortDescription": {
"text": "Reflective invocation arguments mismatch"
},
"fullDescription": {
"text": "Reports cases in which the arguments provided to 'Method.invoke()' and 'Constructor.newInstance()' do not match the signature specified in 'Class.getMethod()' and 'Class.getConstructor()'. Example: 'Method m = myObj.getClass().getMethod(\"myMethod\", int.class);\n // the argument should be an int value\n m.invoke(myObj, \"abc\");' New in 2017.2",
"markdown": "Reports cases in which the arguments provided to `Method.invoke()` and `Constructor.newInstance()` do not match the signature specified in `Class.getMethod()` and `Class.getConstructor()`.\n\nExample:\n\n\n Method m = myObj.getClass().getMethod(\"myMethod\", int.class);\n // the argument should be an **int** value\n m.invoke(myObj, \"abc\");\n\nNew in 2017.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "JavaReflectionInvocation",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Reflective access",
"index": 128,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CaughtExceptionImmediatelyRethrown",
"shortDescription": {
"text": "Caught exception is immediately rethrown"
},
"fullDescription": {
"text": "Reports 'catch' blocks that immediately rethrow the caught exception without performing any action on it. Such 'catch' blocks are unnecessary and have no error handling. Example: 'try {\n new FileInputStream(\"\");\n } catch (FileNotFoundException e) {\n throw e;\n }'",
"markdown": "Reports `catch` blocks that immediately rethrow the caught exception without performing any action on it. Such `catch` blocks are unnecessary and have no error handling.\n\n**Example:**\n\n\n try {\n new FileInputStream(\"\");\n } catch (FileNotFoundException e) {\n throw e;\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "CaughtExceptionImmediatelyRethrown",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ArrayHashCode",
"shortDescription": {
"text": "'hashCode()' called on array"
},
"fullDescription": {
"text": "Reports incorrect hash code calculation for arrays. In order to correctly calculate the hash code for an array, use: 'Arrays.hashcode()' for linear arrays 'Arrays.deepHashcode()' for multidimensional arrays These methods should also be used with 'Objects.hash()' when the sequence of input values includes arrays, for example: 'Objects.hash(string, Arrays.hashcode(array))'",
"markdown": "Reports incorrect hash code calculation for arrays.\n\nIn order to\ncorrectly calculate the hash code for an array, use:\n\n* `Arrays.hashcode()` for linear arrays\n* `Arrays.deepHashcode()` for multidimensional arrays\n\nThese methods should also be used with `Objects.hash()` when the sequence of input values includes arrays, for example: `Objects.hash(string, Arrays.hashcode(array))`"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ArrayHashCode",
"cweIds": [
328
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "WaitNotInLoop",
"shortDescription": {
"text": "'wait()' not called in loop"
},
"fullDescription": {
"text": "Reports calls to 'wait()' that are not made inside a loop. 'wait()' is normally used to suspend a thread until some condition becomes true. As the thread could have been waken up for a different reason, the condition should be checked after the 'wait()' call returns. A loop is a simple way to achieve this. Example: 'class BoundedCounter {\n private int count;\n synchronized void inc() throws InterruptedException {\n if (count >= 10) wait();\n ++count;\n }\n }' Good code should look like this: 'class BoundedCounter {\n private int count;\n synchronized void inc() throws InterruptedException {\n while (count >= 10) wait();\n ++count;\n }\n }'",
"markdown": "Reports calls to `wait()` that are not made inside a loop.\n\n\n`wait()` is normally used to suspend a thread until some condition becomes true.\nAs the thread could have been waken up for a different reason,\nthe condition should be checked after the `wait()` call returns.\nA loop is a simple way to achieve this.\n\n**Example:**\n\n\n class BoundedCounter {\n private int count;\n synchronized void inc() throws InterruptedException {\n if (count >= 10) wait();\n ++count;\n }\n }\n\nGood code should look like this:\n\n\n class BoundedCounter {\n private int count;\n synchronized void inc() throws InterruptedException {\n while (count >= 10) wait();\n ++count;\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "WaitNotInLoop",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ExternalizableWithSerializationMethods",
"shortDescription": {
"text": "Externalizable class with 'readObject()' or 'writeObject()'"
},
"fullDescription": {
"text": "Reports 'Externalizable' classes that define 'readObject()' or 'writeObject()' methods. These methods are not called for serialization of 'Externalizable' objects. Example: 'abstract class Crucial implements Externalizable {\n int value;\n private void readObject(ObjectInputStream in) {\n value = in.readInt();\n }\n }'",
"markdown": "Reports `Externalizable` classes that define `readObject()` or `writeObject()` methods. These methods are not called for serialization of `Externalizable` objects.\n\n**Example:**\n\n\n abstract class Crucial implements Externalizable {\n int value;\n private void readObject(ObjectInputStream in) {\n value = in.readInt();\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ExternalizableClassWithSerializationMethods",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Serialization issues",
"index": 20,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SafeLock",
"shortDescription": {
"text": "Lock acquired but not safely unlocked"
},
"fullDescription": {
"text": "Reports 'java.util.concurrent.locks.Lock' resources that are not acquired in front of a 'try' block or not unlocked in the corresponding 'finally' block. Such resources may be inadvertently leaked if an exception is thrown before the resource is closed. Example: 'lock.lock(); // will be reported since the 'finally' block is missing\n try {\n doSmthWithLock();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n lock.unlock();'",
"markdown": "Reports `java.util.concurrent.locks.Lock` resources that are not acquired in front of a `try` block or not unlocked in the corresponding `finally` block. Such resources may be inadvertently leaked if an exception is thrown before the resource is closed.\n\n**Example:**\n\n\n lock.lock(); // will be reported since the 'finally' block is missing\n try {\n doSmthWithLock();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n lock.unlock();\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "LockAcquiredButNotSafelyReleased",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaLangInvokeHandleSignature",
"shortDescription": {
"text": "MethodHandle/VarHandle type mismatch"
},
"fullDescription": {
"text": "Reports 'MethodHandle' and 'VarHandle' factory method calls that don't match any method or field. Also reports arguments to 'MethodHandle.invoke()' and similar methods, that don't match the 'MethodHandle' signature and arguments to 'VarHandle.set()' that don't match the 'VarHandle' type. Examples: MethodHandle mh = MethodHandles.lookup().findVirtual(\n MyClass.class, \"foo\", MethodType.methodType(void.class, int.class));\n // the argument should be an int value\n mh.invoke(myObj, \"abc\");\n // the argument should be String.class\n VarHandle vh = MethodHandles.lookup().findVarHandle(\n MyClass.class, \"text\", int.class);\n VarHandle vh = MethodHandles.lookup().findVarHandle(\n MyClass.class, \"text\", String.class);\n // the argument should be a String value\n vh.set(myObj, 42);\n New in 2017.2",
"markdown": "Reports `MethodHandle` and `VarHandle` factory method calls that don't match any method or field.\n\nAlso reports arguments to `MethodHandle.invoke()` and similar methods, that don't match the `MethodHandle` signature\nand arguments to `VarHandle.set()` that don't match the `VarHandle` type.\n\n\nExamples:\n\n```\n MethodHandle mh = MethodHandles.lookup().findVirtual(\n MyClass.class, \"foo\", MethodType.methodType(void.class, int.class));\n // the argument should be an int value\n mh.invoke(myObj, \"abc\");\n```\n\n```\n // the argument should be String.class\n VarHandle vh = MethodHandles.lookup().findVarHandle(\n MyClass.class, \"text\", int.class);\n```\n\n```\n VarHandle vh = MethodHandles.lookup().findVarHandle(\n MyClass.class, \"text\", String.class);\n // the argument should be a String value\n vh.set(myObj, 42);\n```\n\n\nNew in 2017.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "JavaLangInvokeHandleSignature",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Reflective access",
"index": 128,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ReturnThis",
"shortDescription": {
"text": "Return of 'this'"
},
"fullDescription": {
"text": "Reports methods returning 'this'. While such a return is valid, it is rarely necessary, and usually indicates that the method is intended to be used as part of a chain of similar method calls (for example, 'buffer.append(\"foo\").append(\"bar\").append(\"baz\")'). Such chains are frowned upon by many coding standards. Example: 'public Builder append(String str) {\n // [...]\n return this;\n }'",
"markdown": "Reports methods returning `this`.\n\n\nWhile such a return is valid, it is rarely necessary, and usually indicates that the method is intended to be used\nas part of a chain of similar method calls (for example, `buffer.append(\"foo\").append(\"bar\").append(\"baz\")`).\nSuch chains are frowned upon by many coding standards.\n\n**Example:**\n\n\n public Builder append(String str) {\n // [...]\n return this;\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ReturnOfThis",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CanBeFinal",
"shortDescription": {
"text": "Declaration can have 'final' modifier"
},
"fullDescription": {
"text": "Reports fields, methods, or classes that may have the 'final' modifier added to their declarations. Final classes can't be extended, final methods can't be overridden, and final fields can't be reassigned. Example: 'public class Person {\n private String name;\n\n Person(String name) {\n this.name = name;\n }\n\n public String getName() {\n return name;\n }\n\n public String toString() {\n return getName();\n }\n }' After the quick-fix is applied: 'public final class Person {\n private final String name;\n\n Person(String name) {\n this.name = name;\n }\n\n public final String getName() {\n return name;\n }\n\n public final String toString() {\n return getName();\n }\n }' Use the Report classes and Report methods options to define which declarations are to be reported.",
"markdown": "Reports fields, methods, or classes that may have the `final` modifier added to their declarations.\n\nFinal classes can't be extended, final methods can't be overridden, and final fields can't be reassigned.\n\n**Example:**\n\n\n public class Person {\n private String name;\n\n Person(String name) {\n this.name = name;\n }\n\n public String getName() {\n return name;\n }\n\n public String toString() {\n return getName();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public final class Person {\n private final String name;\n\n Person(String name) {\n this.name = name;\n }\n\n public final String getName() {\n return name;\n }\n\n public final String toString() {\n return getName();\n }\n }\n\nUse the **Report classes** and **Report methods** options to define which declarations are to be reported."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CanBeFinal",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Declaration redundancy",
"index": 12,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryLabelOnBreakStatement",
"shortDescription": {
"text": "Unnecessary label on 'break' statement"
},
"fullDescription": {
"text": "Reports 'break' statements with unnecessary labels. Such labels do not change the control flow but make the code difficult to follow. Example: 'label:\n for(int i = 0; i < 10; i++) {\n if (shouldBreak()) break label;\n //doSmth\n }' After the quick-fix is applied: 'label:\n for(int i = 0; i < 10; i++) {\n if (shouldBreak()) break;\n //doSmth\n }'",
"markdown": "Reports `break` statements with unnecessary labels. Such labels do not change the control flow but make the code difficult to follow.\n\n**Example:**\n\n\n label:\n for(int i = 0; i < 10; i++) {\n if (shouldBreak()) break label;\n //doSmth\n }\n\nAfter the quick-fix is applied:\n\n\n label:\n for(int i = 0; i < 10; i++) {\n if (shouldBreak()) break;\n //doSmth\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryLabelOnBreakStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NakedNotify",
"shortDescription": {
"text": "'notify()' or 'notifyAll()' without corresponding state change"
},
"fullDescription": {
"text": "Reports 'Object.notify()' or 'Object.notifyAll()' being called without any detectable state change occurring. Normally, 'Object.notify()' and 'Object.notifyAll()' are used to inform other threads that a state change has occurred. That state change should occur in a synchronized context that contains the 'Object.notify()' or 'Object.notifyAll()' call, and prior to the call. While not having such a state change isn't necessarily incorrect, it is certainly worth examining. Example: 'synchronized (this) {\n notify();\n }\n // no state change\n synchronized (this) {\n notify(); // this notify might be redundant\n }'",
"markdown": "Reports `Object.notify()` or `Object.notifyAll()` being called without any detectable state change occurring.\n\n\nNormally, `Object.notify()` and `Object.notifyAll()` are used to inform other threads that a state change has\noccurred. That state change should occur in a synchronized context that contains the `Object.notify()` or\n`Object.notifyAll()` call, and prior to the call. While not having such a state change isn't necessarily incorrect, it is\ncertainly worth examining.\n\n**Example:**\n\n\n synchronized (this) {\n notify();\n }\n // no state change\n synchronized (this) {\n notify(); // this notify might be redundant\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NakedNotify",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassCoupling",
"shortDescription": {
"text": "Overly coupled class"
},
"fullDescription": {
"text": "Reports classes that reference too many other classes. Classes with too high coupling can be very fragile, and should probably be split into smaller classes. Configure the inspection: Use the Class coupling limit field to specify the maximum allowed coupling for a class. Use the Include couplings to java system classes option to specify whether references to system classes (those in the 'java.'or 'javax.' packages) should be counted. Use the Include couplings to library classes option to specify whether references to any library classes should be counted.",
"markdown": "Reports classes that reference too many other classes.\n\nClasses with too high coupling can be very fragile, and should probably be split into smaller classes.\n\nConfigure the inspection:\n\n* Use the **Class coupling limit** field to specify the maximum allowed coupling for a class.\n* Use the **Include couplings to java system classes** option to specify whether references to system classes (those in the `java.`or `javax.` packages) should be counted.\n* Use the **Include couplings to library classes** option to specify whether references to any library classes should be counted."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OverlyCoupledClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class metrics",
"index": 123,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "EmptySynchronizedStatement",
"shortDescription": {
"text": "Empty 'synchronized' statement"
},
"fullDescription": {
"text": "Reports 'synchronized' statements with empty bodies. Empty 'synchronized' statements are sometimes used to wait for other threads to release a particular resource. However, there is no guarantee that the same resource won't be acquired again right after the empty 'synchronized' statement finishes. For proper synchronization, the resource should be utilized inside the 'synchronized' block. Also, an empty 'synchronized' block may appear after a refactoring when redundant code was removed. In this case, the 'synchronized' block itself will be redundant and should be removed as well. Example: 'synchronized(lock) {}' A quick-fix is suggested to remove the empty synchronized statement. This inspection is disabled in JSP files.",
"markdown": "Reports `synchronized` statements with empty bodies.\n\n\nEmpty `synchronized` statements are sometimes used to wait for other threads to\nrelease a particular resource. However, there is no guarantee that the same resource\nwon't be acquired again right after the empty `synchronized` statement finishes.\nFor proper synchronization, the resource should be utilized inside the `synchronized` block.\n\n\nAlso, an empty `synchronized` block may appear after a refactoring\nwhen redundant code was removed. In this case, the `synchronized` block\nitself will be redundant and should be removed as well.\n\nExample:\n\n\n synchronized(lock) {}\n\n\nA quick-fix is suggested to remove the empty synchronized statement.\n\n\nThis inspection is disabled in JSP files."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "EmptySynchronizedStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TextBlockMigration",
"shortDescription": {
"text": "Text block can be used"
},
"fullDescription": {
"text": "Reports 'String' concatenations that can be simplified by replacing them with text blocks. Requirements: '\\n' occurs two or more times. Text blocks are not concatenated. Use the Apply to single string literals option to suggest the fix for single literals containing line breaks. Example: 'String html = \"<html>\\n\" +\n \" <body>\\n\" +\n \" <p>Hello, world</p>\\n\" +\n \" </body>\\n\" +\n \"</html>\\n\";' After the quick-fix is applied: 'String html = \"\"\"\n <html>\n <body>\n <p>Hello, world</p>\n </body>\n </html>\n \"\"\";' This inspection only reports if the language level of the project or module is 15 or higher. New in 2019.3",
"markdown": "Reports `String` concatenations that can be simplified by replacing them with text blocks.\n\nRequirements:\n\n* `\\n` occurs two or more times.\n* Text blocks are not concatenated.\n\n\nUse the **Apply to single string literals** option to suggest the fix for single literals containing line breaks.\n\n\n**Example:**\n\n\n String html = \"<html>\\n\" +\n \" <body>\\n\" +\n \" <p>Hello, world</p>\\n\" +\n \" </body>\\n\" +\n \"</html>\\n\";\n\nAfter the quick-fix is applied:\n\n\n String html = \"\"\"\n <html>\n <body>\n <p>Hello, world</p>\n </body>\n </html>\n \"\"\";\n\nThis inspection only reports if the language level of the project or module is 15 or higher.\n\nNew in 2019.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "TextBlockMigration",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 15",
"index": 129,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ObjectAllocationInLoop",
"shortDescription": {
"text": "Object allocation in loop"
},
"fullDescription": {
"text": "Reports object or array allocations inside loops. While not necessarily a problem, an object allocation inside a loop is a great place to look for memory leaks and performance issues. The inspection reports the following constructs: Explicit allocations via 'new' operator Methods known to return new object Instance-bound method references Lambdas that capture variables or 'this' reference Example: '// Explicit allocation\n for (Status status : Status.values()) {\n declarationsMap.put(status, new ArrayList<>());\n }\n\n // Lambda captures variable\n String message = \"Engine running.\";\n for (Engine engine : engines) {\n if (!isRunning(engine)) {\n logger.warn(() -> {\n return String.format(message);\n });\n }\n }\n\n // Instance-bound method reference\n for(Node node : nodes) {\n descriptor = node.getDescription();\n descriptor.ifPresent(dynamicTestExecutor::execute);\n }'",
"markdown": "Reports object or array allocations inside loops. While not necessarily a problem, an object allocation inside a loop is a great place to look for memory leaks and performance issues.\n\n\nThe inspection reports the following constructs:\n\n* Explicit allocations via `new` operator\n* Methods known to return new object\n* Instance-bound method references\n* Lambdas that capture variables or `this` reference\n\n**Example:**\n\n\n // Explicit allocation\n for (Status status : Status.values()) {\n declarationsMap.put(status, new ArrayList<>());\n }\n\n // Lambda captures variable\n String message = \"Engine running.\";\n for (Engine engine : engines) {\n if (!isRunning(engine)) {\n logger.warn(() -> {\n return String.format(message);\n });\n }\n }\n\n // Instance-bound method reference\n for(Node node : nodes) {\n descriptor = node.getDescription();\n descriptor.ifPresent(dynamicTestExecutor::execute);\n }\n\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ObjectAllocationInLoop",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NonFinalClone",
"shortDescription": {
"text": "Non-final 'clone()' in secure context"
},
"fullDescription": {
"text": "Reports 'clone()' methods without the 'final' modifier. Since 'clone()' can be used to instantiate objects without using a constructor, allowing the 'clone()' method to be overridden may result in corrupted objects, and even in security exploits. This may be prevented by making the 'clone()' method or the enclosing class itself 'final'. Example: 'class Main implements Cloneable {\n @Override\n protected Object clone() throws CloneNotSupportedException {\n return super.clone();\n }\n }'",
"markdown": "Reports `clone()` methods without the `final` modifier.\n\n\nSince `clone()` can be used to instantiate objects without using a constructor, allowing the `clone()`\nmethod to be overridden may result in corrupted objects, and even in security exploits. This may be prevented by making the\n`clone()` method or the enclosing class itself `final`.\n\n**Example:**\n\n\n class Main implements Cloneable {\n @Override\n protected Object clone() throws CloneNotSupportedException {\n return super.clone();\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonFinalClone",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Security",
"index": 38,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ChainedEquality",
"shortDescription": {
"text": "Chained equality comparisons"
},
"fullDescription": {
"text": "Reports chained equality comparisons. Such comparisons may be confusing: 'a == b == c' means '(a == b) == c', but possibly 'a == b && a == c' is intended. Example: 'boolean chainedEquality(boolean a, boolean b, boolean c) {\n return a == b == c;\n }' You can use parentheses to make the comparison less confusing: 'boolean chainedEquality(boolean a, boolean b, boolean c) {\n return (a == b) == c;\n }'",
"markdown": "Reports chained equality comparisons.\n\nSuch comparisons may be confusing: `a == b == c` means `(a == b) == c`,\nbut possibly `a == b && a == c` is intended.\n\n**Example:**\n\n\n boolean chainedEquality(boolean a, boolean b, boolean c) {\n return a == b == c;\n }\n\nYou can use parentheses to make the comparison less confusing:\n\n\n boolean chainedEquality(boolean a, boolean b, boolean c) {\n return (a == b) == c;\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ChainedEqualityComparisons",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LossyConversionCompoundAssignment",
"shortDescription": {
"text": "Possibly lossy implicit cast in compound assignment"
},
"fullDescription": {
"text": "Reports compound assignments if the type of the right-hand operand is not assignment compatible with the type of the variable. During such compound assignments, an implicit cast occurs, potentially resulting in lossy conversions. Example: 'long c = 1;\n c += 1.2;' After the quick-fix is applied: 'long c = 1;\n c += (long) 1.2;' New in 2023.2",
"markdown": "Reports compound assignments if the type of the right-hand operand is not assignment compatible with the type of the variable.\n\n\nDuring such compound assignments, an implicit cast occurs, potentially resulting in lossy conversions.\n\nExample:\n\n\n long c = 1;\n c += 1.2;\n\nAfter the quick-fix is applied:\n\n\n long c = 1;\n c += (long) 1.2;\n\nNew in 2023.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "lossy-conversions",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ThrowFromFinallyBlock",
"shortDescription": {
"text": "'throw' inside 'finally' block"
},
"fullDescription": {
"text": "Reports 'throw' statements inside 'finally' blocks. While occasionally intended, such 'throw' statements may conceal exceptions thrown from 'try'-'catch' and thus tremendously complicate the debugging process.",
"markdown": "Reports `throw` statements inside `finally` blocks.\n\nWhile occasionally intended, such `throw` statements may conceal exceptions thrown from `try`-`catch` and thus\ntremendously complicate the debugging process."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ThrowFromFinallyBlock",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StaticNonFinalField",
"shortDescription": {
"text": "'static', non-'final' field"
},
"fullDescription": {
"text": "Reports non-'final' 'static' fields. A quick-fix is available to add the 'final' modifier to a non-'final' 'static' field. This inspection doesn't check fields' mutability. For example, adding the 'final' modifier to a field that has a value being set somewhere will cause a compilation error. Use the Only report 'public' fields option so that the inspection reported only 'public' fields.",
"markdown": "Reports non-`final` `static` fields.\n\nA quick-fix is available to add the `final` modifier to a non-`final` `static` field.\n\nThis inspection doesn't check fields' mutability. For example, adding the `final` modifier to a field that has a value\nbeing set somewhere will cause a compilation error.\n\n\nUse the **Only report 'public' fields** option so that the inspection reported only `public` fields."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "StaticNonFinalField",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "EmptyMethod",
"shortDescription": {
"text": "Empty method"
},
"fullDescription": {
"text": "Reports empty methods that can be removed. Methods are considered empty if they are empty themselves and if they are overridden or implemented by empty methods only. Note that methods containing only comments and the 'super()' call with own parameters are also considered empty. The inspection ignores methods with special annotations, for example, the 'javax.ejb.Init' and 'javax.ejb.Remove' EJB annotations . The quick-fix safely removes unnecessary methods. Configure the inspection: Use the Comments and javadoc count as content option to select whether methods with comments should be treated as non-empty. Use the Additional special annotations option to configure additional annotations that should be ignored by this inspection.",
"markdown": "Reports empty methods that can be removed.\n\nMethods are considered empty if they are empty themselves and if they are overridden or\nimplemented by empty methods only. Note that methods containing only comments and the `super()` call with own parameters are\nalso considered empty.\n\nThe inspection ignores methods with special annotations, for example, the `javax.ejb.Init` and `javax.ejb.Remove` EJB annotations .\n\nThe quick-fix safely removes unnecessary methods.\n\nConfigure the inspection:\n\n* Use the **Comments and javadoc count as content** option to select whether methods with comments should be treated as non-empty.\n* Use the **Additional special annotations** option to configure additional annotations that should be ignored by this inspection."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "EmptyMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Declaration redundancy",
"index": 12,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SimplifiableEqualsExpression",
"shortDescription": {
"text": "Unnecessary 'null' check before 'equals()' call"
},
"fullDescription": {
"text": "Reports comparisons to 'null' that are followed by a call to 'equals()' with a constant argument. Example: 'if (s != null && s.equals(\"literal\")) {}' After the quick-fix is applied: 'if (\"literal\".equals(s)) {}' Use the inspection settings to report 'equals()' calls with a non-constant argument when the argument to 'equals()' is proven not to be 'null'.",
"markdown": "Reports comparisons to `null` that are followed by a call to `equals()` with a constant argument.\n\n**Example:**\n\n\n if (s != null && s.equals(\"literal\")) {}\n\nAfter the quick-fix is applied:\n\n\n if (\"literal\".equals(s)) {}\n\n\nUse the inspection settings to report `equals()` calls with a non-constant argument\nwhen the argument to `equals()` is proven not to be `null`."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SimplifiableEqualsExpression",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NonCommentSourceStatements",
"shortDescription": {
"text": "Overly long method"
},
"fullDescription": {
"text": "Reports methods whose number of statements exceeds the specified maximum. Methods with too many statements may be confusing and are a good sign that refactoring is necessary. The following statements are not counted: empty statements (semicolons) block statements 'for' loop initialization statements, that is, 'int i = ...' within a 'for(int i = ...;...)' statement 'for' loop update statements, that is, 'i += 2' within a 'for(int i = ...;...; i += 2)' statement Use the Maximum statements per method field to specify the maximum allowed number of statements in a method.",
"markdown": "Reports methods whose number of statements exceeds the specified maximum.\n\nMethods with too many statements may be confusing and are a good sign that refactoring is necessary.\n\nThe following statements are not counted:\n\n* empty statements (semicolons)\n* block statements\n* `for` loop initialization statements, that is, `int i = ...` within a `for(int i = ...;...)` statement\n* `for` loop update statements, that is, `i += 2` within a `for(int i = ...;...; i += 2)` statement\n\nUse the **Maximum statements per method** field to specify the maximum allowed number of statements in a method."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OverlyLongMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Method metrics",
"index": 132,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ConfusingMainMethod",
"shortDescription": {
"text": "Confusing 'main()' method"
},
"fullDescription": {
"text": "Reports methods that are named \"main\", but do not have the 'public static void main(String[])' signature in Java up to 21. Starting from Java 21 Preview, inspection doesn't highlight in case of package-private, protected or instance main methods, also without parameters. Additionally main methods located in anonymous or local classes are reported. Anonymous and local classes do not have a fully qualified name and thus can't be run. Such methods may be confusing, as methods named \"main\" are expected to be application entry points. Example: 'class Main {\n void main(String[] args) {} // warning here because there are no \"public static\" modifiers\n }' A quick-fix that renames such methods is available only in the editor.",
"markdown": "Reports methods that are named \"main\", but do not have the `public static void main(String[])` signature in Java up to 21. Starting from Java 21 Preview, inspection doesn't highlight in case of package-private, protected or instance main methods, also without parameters. Additionally main methods located in anonymous or local classes are reported. Anonymous and local classes do not have a fully qualified name and thus can't be run.\n\nSuch methods may be confusing, as methods named \"main\"\nare expected to be application entry points.\n\n**Example:**\n\n\n class Main {\n void main(String[] args) {} // warning here because there are no \"public static\" modifiers\n }\n\nA quick-fix that renames such methods is available only in the editor."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ConfusingMainMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MultipleVariablesInDeclaration",
"shortDescription": {
"text": "Multiple variables in one declaration"
},
"fullDescription": {
"text": "Reports multiple variables that are declared in a single declaration and suggest creating a separate declaration for each variable. Some coding standards prohibit such declarations. Example: 'int x = 1, y = 2;' After the quick-fix is applied: 'int x = 1;\n int y = 2;' Configure the inspection: Use the Ignore 'for' loop declarations option to ignore multiple variables declared in the initialization of a 'for' loop statement, for example: 'for (int i = 0, max = list.size(); i > max; i++) {}' Use the Only warn on different array dimensions in a single declaration option to only warn when variables with different array dimensions are declared in a single declaration, for example: 'String s = \"\", array[];' New in 2019.2",
"markdown": "Reports multiple variables that are declared in a single declaration and suggest creating a separate declaration for each variable.\n\nSome coding standards prohibit such declarations.\n\nExample:\n\n\n int x = 1, y = 2;\n\nAfter the quick-fix is applied:\n\n\n int x = 1;\n int y = 2;\n\nConfigure the inspection:\n\n* Use the **Ignore 'for' loop declarations** option to ignore multiple variables declared in the initialization of a 'for' loop statement, for example:\n\n\n for (int i = 0, max = list.size(); i > max; i++) {}\n\n* Use the **Only warn on different array dimensions in a single declaration** option to only warn when variables with different array dimensions are declared in a single declaration, for example:\n\n\n String s = \"\", array[];\n\nNew in 2019.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "MultipleVariablesInDeclaration",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "IOResource",
"shortDescription": {
"text": "I/O resource opened but not safely closed"
},
"fullDescription": {
"text": "Reports I/O resources that are not safely closed. I/O resources checked by this inspection include 'java.io.InputStream', 'java.io.OutputStream', 'java.io.Reader', 'java.io.Writer', 'java.util.zip.ZipFile', 'java.io.Closeable' and 'java.io.RandomAccessFile'. I/O resources wrapped by other I/O resources are not reported, as the wrapped resource will be closed by the wrapping resource. By default, the inspection assumes that the resources can be closed by any method with 'close' or 'cleanup' in its name. Example: 'void save() throws IOException {\n FileWriter writer = new FileWriter(\"filename.txt\"); //warning\n writer.write(\"sample\");\n }' Use the following options to configure the inspection: List I/O resource classes that do not need to be closed and should be ignored by this inspection. Whether an I/O resource is allowed to be opened inside a 'try'block. This style is less desirable because it is more verbose than opening a resource in front of a 'try' block. Whether the resource can be closed by any method call with the resource passed as argument.",
"markdown": "Reports I/O resources that are not safely closed. I/O resources checked by this inspection include `java.io.InputStream`, `java.io.OutputStream`, `java.io.Reader`, `java.io.Writer`, `java.util.zip.ZipFile`, `java.io.Closeable` and `java.io.RandomAccessFile`.\n\n\nI/O resources wrapped by other I/O resources are not reported, as the wrapped resource will be closed by the wrapping resource.\n\n\nBy default, the inspection assumes that the resources can be closed by any method with\n'close' or 'cleanup' in its name.\n\n**Example:**\n\n\n void save() throws IOException {\n FileWriter writer = new FileWriter(\"filename.txt\"); //warning\n writer.write(\"sample\");\n }\n\n\nUse the following options to configure the inspection:\n\n* List I/O resource classes that do not need to be closed and should be ignored by this inspection.\n* Whether an I/O resource is allowed to be opened inside a `try`block. This style is less desirable because it is more verbose than opening a resource in front of a `try` block.\n* Whether the resource can be closed by any method call with the resource passed as argument."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "IOResourceOpenedButNotSafelyClosed",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Resource management",
"index": 133,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CallToSimpleGetterInClass",
"shortDescription": {
"text": "Call to simple getter from within class"
},
"fullDescription": {
"text": "Reports calls to a simple property getter from within the property's class. A simple property getter is defined as one which simply returns the value of a field, and does no other calculations. Such simple getter calls can be safely inlined using the quick-fix. Some coding standards also suggest against the use of simple getters for code clarity reasons. Example: 'public class Salient {\n private String name;\n\n public String getName() {\n return name;\n }\n\n @Override\n public String toString() {\n return getName();\n }\n }' After the quick-fix is applied: 'public class Salient {\n private String name;\n\n public String getName() {\n return name;\n }\n\n @Override\n public String toString() {\n return name;\n }\n }' Use the following options to configure the inspection: Whether to only report getter calls on 'this', not on objects of the same type passed in as a parameter. Whether to ignore non-'private' getters.",
"markdown": "Reports calls to a simple property getter from within the property's class.\n\n\nA simple property getter is defined as one which simply returns the value of a field,\nand does no other calculations. Such simple getter calls can be safely inlined using the quick-fix.\nSome coding standards also suggest against the use of simple getters for code clarity reasons.\n\n**Example:**\n\n\n public class Salient {\n private String name;\n\n public String getName() {\n return name;\n }\n\n @Override\n public String toString() {\n return getName();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Salient {\n private String name;\n\n public String getName() {\n return name;\n }\n\n @Override\n public String toString() {\n return name;\n }\n }\n\nUse the following options to configure the inspection:\n\n* Whether to only report getter calls on `this`, not on objects of the same type passed in as a parameter.\n* Whether to ignore non-`private` getters."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CallToSimpleGetterFromWithinClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NonSerializableFieldInSerializableClass",
"shortDescription": {
"text": "Non-serializable field in a 'Serializable' class"
},
"fullDescription": {
"text": "Reports non-serializable fields in classes that implement 'java.io.Serializable'. Such fields will result in runtime exceptions if the object is serialized. Fields declared 'transient' or 'static' are not reported, nor are fields of classes that have a 'writeObject' method defined. This inspection assumes fields of the types 'java.util.Collection' and 'java.util.Map' to be 'Serializable', unless the types they are declared in are non-'Serializable'. Example: 'class NonSerializableClass {}\n\n public class SerializableClass implements Serializable {\n NonSerializableClass clazz; // warning: Non-serializable field 'clazz' in a Serializable class\n static NonSerializableClass staticClazz; // no warnings\n }'\n Use the following options to configure the inspection: List classes whose inheritors should not be reported by this inspection. This is meant for classes that inherit 'Serializable' from a superclass but are not intended for serialization. List annotations that will make the inspection ignore the annotated fields. Whether to ignore fields initialized with an anonymous class.",
"markdown": "Reports non-serializable fields in classes that implement `java.io.Serializable`. Such fields will result in runtime exceptions if the object is serialized.\n\n\nFields declared\n`transient` or `static`\nare not reported, nor are fields of classes that have a `writeObject` method defined.\n\n\nThis inspection assumes fields of the types\n`java.util.Collection` and\n`java.util.Map` to be\n`Serializable`, unless the types\nthey are declared in are non-`Serializable`.\n\n**Example:**\n\n\n class NonSerializableClass {}\n\n public class SerializableClass implements Serializable {\n NonSerializableClass clazz; // warning: Non-serializable field 'clazz' in a Serializable class\n static NonSerializableClass staticClazz; // no warnings\n }\n \n\nUse the following options to configure the inspection:\n\n* List classes whose inheritors should not be reported by this inspection. This is meant for classes that inherit `Serializable` from a superclass but are not intended for serialization.\n* List annotations that will make the inspection ignore the annotated fields.\n* Whether to ignore fields initialized with an anonymous class."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonSerializableFieldInSerializableClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Serialization issues",
"index": 20,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "EnhancedSwitchMigration",
"shortDescription": {
"text": "Statement can be replaced with enhanced 'switch'"
},
"fullDescription": {
"text": "Reports 'switch' statements that can be automatically replaced with enhanced 'switch' statements or expressions. Example: 'double getPrice(String fruit) {\n // Switch statement can be replaced with enhanced 'switch'\n switch (fruit) {\n case \"Apple\":\n return 1.0;\n case \"Orange\":\n return 1.5;\n case \"Mango\":\n return 2.0;\n default:\n throw new IllegalArgumentException();\n }\n }' After the quick-fix is applied: 'double getPrice(String fruit) {\n return switch (fruit) {\n case \"Apple\" -> 1.0;\n case \"Orange\" -> 1.5;\n case \"Mango\" -> 2.0;\n default -> throw new IllegalArgumentException();\n };\n }' Use the Show warning only if conversion to expression is possible option not to warn about conversion to 'switch' statement. Use the Maximum number of statements in one branch to convert to switch expression option warn about conversion to expression only if each branch has less than the given number of statements. This inspection only reports if the language level of the project or module is 14 or higher New in 2019.1",
"markdown": "Reports `switch` statements that can be automatically replaced with enhanced `switch` statements or expressions.\n\n**Example:**\n\n\n double getPrice(String fruit) {\n // Switch statement can be replaced with enhanced 'switch'\n switch (fruit) {\n case \"Apple\":\n return 1.0;\n case \"Orange\":\n return 1.5;\n case \"Mango\":\n return 2.0;\n default:\n throw new IllegalArgumentException();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n double getPrice(String fruit) {\n return switch (fruit) {\n case \"Apple\" -> 1.0;\n case \"Orange\" -> 1.5;\n case \"Mango\" -> 2.0;\n default -> throw new IllegalArgumentException();\n };\n }\n \n\n* Use the **Show warning only if conversion to expression is possible** option not to warn about conversion to `switch` statement.\n* Use the **Maximum number of statements in one branch to convert to switch expression** option warn about conversion to expression only if each branch has less than the given number of statements.\n\nThis inspection only reports if the language level of the project or module is 14 or higher\n\nNew in 2019.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "EnhancedSwitchMigration",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 14",
"index": 135,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "DoubleLiteralMayBeFloatLiteral",
"shortDescription": {
"text": "Cast to 'float' can be 'float' literal"
},
"fullDescription": {
"text": "Reports 'double' literal expressions that are immediately cast to 'float'. Such literal expressions can be replaced with equivalent 'float' literals. Example: 'float f = (float)1.1;' After the quick-fix is applied: 'float f = 1.1f;'",
"markdown": "Reports `double` literal expressions that are immediately cast to `float`.\n\nSuch literal expressions can be replaced with equivalent `float` literals.\n\n**Example:**\n\n float f = (float)1.1;\n\nAfter the quick-fix is applied:\n\n float f = 1.1f;\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "DoubleLiteralMayBeFloatLiteral",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues/Cast",
"index": 136,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OverloadedMethodsWithSameNumberOfParameters",
"shortDescription": {
"text": "Overloaded methods with same number of parameters"
},
"fullDescription": {
"text": "Reports methods that are declared in the same class, have the same name, and the same number of parameters. Such overloads cam be very confusing because it can be unclear which overload gets called. Example: 'class Main {\n public static void execute(Runnable r) {}\n public static <T> void execute(RunnableFuture<T> c) {}\n }' Use the option to ignore overloaded methods whose parameter types are definitely incompatible.",
"markdown": "Reports methods that are declared in the same class, have the same name, and the same number of parameters. Such overloads cam be very confusing because it can be unclear which overload gets called.\n\n**Example:**\n\n\n class Main {\n public static void execute(Runnable r) {}\n public static <T> void execute(RunnableFuture<T> c) {}\n }\n\n\nUse the option to ignore overloaded methods whose parameter types are definitely incompatible."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OverloadedMethodsWithSameNumberOfParameters",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Naming conventions/Method",
"index": 108,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OverlyLongLambda",
"shortDescription": {
"text": "Overly long lambda expression"
},
"fullDescription": {
"text": "Reports lambda expressions whose number of statements exceeds the specified maximum. Lambda expressions that are too long may be confusing, and it is often better to extract the statements into a separate method. The following statements are not counted: empty statements (semicolons) block statements 'for' loop initialization statements, that is, 'int i = ...' within a 'for(int i = ...;...)' statement 'for' loop update statements, that is, 'i += 2' within a 'for(int i = ...;...; i += 2)' statement Use the Non-comment source statements limit field to specify the maximum allowed number of statements in a lambda expression.",
"markdown": "Reports lambda expressions whose number of statements exceeds the specified maximum.\n\nLambda expressions that are too long may be confusing, and it is often better to extract the statements into a separate method.\n\n\nThe following statements are not counted:\n\n* empty statements (semicolons)\n* block statements\n* `for` loop initialization statements, that is, `int i = ...` within a `for(int i = ...;...)` statement\n* `for` loop update statements, that is, `i += 2` within a `for(int i = ...;...; i += 2)` statement\n\nUse the **Non-comment source statements limit** field to specify the maximum allowed number of statements in a lambda expression."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OverlyLongLambda",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Method metrics",
"index": 132,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ParametersPerMethod",
"shortDescription": {
"text": "Method with too many parameters"
},
"fullDescription": {
"text": "Reports methods whose number of parameters exceeds the specified maximum. Methods with too many parameters can be a good sign that a refactoring is necessary. Methods that have super methods are not reported. Use the Parameter limit field to specify the maximum allowed number of parameters for a method.",
"markdown": "Reports methods whose number of parameters exceeds the specified maximum. Methods with too many parameters can be a good sign that a refactoring is necessary.\n\nMethods that have super methods are not reported.\n\nUse the **Parameter limit** field to specify the maximum allowed number of parameters for a method."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "MethodWithTooManyParameters",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Method metrics",
"index": 132,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CloneDeclaresCloneNotSupported",
"shortDescription": {
"text": "'clone()' does not declare 'CloneNotSupportedException'"
},
"fullDescription": {
"text": "Reports 'clone()' methods that do not declare 'throws CloneNotSupportedException'. If 'throws CloneNotSupportedException' is not declared, the method's subclasses will not be able to prohibit cloning in the standard way. This inspection does not report 'clone()' methods declared 'final' and 'clone()' methods on 'final' classes. Configure the inspection: Use the Only warn on 'protected' clone methods option to indicate that this inspection should only warn on 'protected clone()' methods. The Effective Java book (second and third edition) recommends omitting the 'CloneNotSupportedException' declaration on 'public' methods, because the methods that do not throw checked exceptions are easier to use. Example: 'public class Example implements Cloneable {\n // method doesn't declare 'throws CloneNotSupportedException'\n protected Object clone() {\n try {\n return super.clone();\n } catch (CloneNotSupportedException e) {\n return null;\n }\n }\n }'",
"markdown": "Reports `clone()` methods that do not declare `throws CloneNotSupportedException`.\n\nIf `throws CloneNotSupportedException` is not declared, the method's subclasses will not be able to prohibit cloning\nin the standard way. This inspection does not report `clone()` methods declared `final`\nand `clone()` methods on `final` classes.\n\nConfigure the inspection:\n\nUse the **Only warn on 'protected' clone methods** option to indicate that this inspection should only warn on `protected clone()` methods.\nThe *Effective Java* book (second and third edition) recommends omitting the `CloneNotSupportedException`\ndeclaration on `public` methods, because the methods that do not throw checked exceptions are easier to use.\n\nExample:\n\n\n public class Example implements Cloneable {\n // method doesn't declare 'throws CloneNotSupportedException'\n protected Object clone() {\n try {\n return super.clone();\n } catch (CloneNotSupportedException e) {\n return null;\n }\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "CloneDoesntDeclareCloneNotSupportedException",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Cloning issues",
"index": 115,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "BooleanExpressionMayBeConditional",
"shortDescription": {
"text": "Boolean expression could be replaced with conditional expression"
},
"fullDescription": {
"text": "Reports any 'boolean' expressions which can be formulated in a more compact and, arguably, clear way than by using a conditional expression. Use the quick-fix to replace the 'boolean' expression by a conditional expression. Example: 'a && b || !a && c;' After the quick-fix is applied: 'a ? b : c;'",
"markdown": "Reports any `boolean` expressions which can be formulated in a more compact and, arguably, clear way than by using a conditional expression.\n\nUse the quick-fix to replace the `boolean` expression by a conditional expression.\n\n**Example:**\n\n\n a && b || !a && c;\n\nAfter the quick-fix is applied:\n\n\n a ? b : c;\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "BooleanExpressionMayBeConditional",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryExplicitNumericCast",
"shortDescription": {
"text": "Unnecessary explicit numeric cast"
},
"fullDescription": {
"text": "Reports primitive numeric casts that would be inserted implicitly by the compiler. Also, reports any primitive numeric casts that the compiler will remove. Example: 'int x = (short)5; // The cast will be removed by the javac tool' After the quick-fix is applied: 'int x = 5;'",
"markdown": "Reports primitive numeric casts that would be inserted implicitly by the compiler. Also, reports any primitive numeric casts that the compiler will remove.\n\n**Example:**\n\n int x = (short)5; // The cast will be removed by the javac tool\n\nAfter the quick-fix is applied:\n`int x = 5;`"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryExplicitNumericCast",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues/Cast",
"index": 136,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TransientFieldNotInitialized",
"shortDescription": {
"text": "Transient field is not initialized on deserialization"
},
"fullDescription": {
"text": "Reports 'transient' fields that are initialized during normal object construction, but whose class does not have a 'readObject' method. As 'transient' fields are not serialized they need to be initialized separately in a 'readObject()' method during deserialization. Any 'transient' fields that are not initialized during normal object construction are considered to use the default initialization and are not reported by this inspection. Example: 'class Person implements Serializable {\n transient String name = \"Default\"; //warning, can actually be a null after deserialization\n transient String surname; //null is considered the default value and not reported\n }'",
"markdown": "Reports `transient` fields that are initialized during normal object construction, but whose class does not have a `readObject` method.\n\n\nAs `transient` fields are not serialized they need\nto be initialized separately in a `readObject()` method\nduring deserialization.\n\n\nAny `transient` fields that\nare not initialized during normal object construction are considered to use the default\ninitialization and are not reported by this inspection.\n\n**Example:**\n\n\n class Person implements Serializable {\n transient String name = \"Default\"; //warning, can actually be a null after deserialization\n transient String surname; //null is considered the default value and not reported\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "TransientFieldNotInitialized",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Serialization issues",
"index": 20,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PropertyValueSetToItself",
"shortDescription": {
"text": "Property value set to itself"
},
"fullDescription": {
"text": "Reports calls of setter methods with the same object getter as a value. Usually, this code does nothing and probably was not intended. For example: 'bean.setPayerId(bean.getPayerId());'",
"markdown": "Reports calls of setter methods with the same object getter as a value. Usually, this code does nothing and probably was not intended.\n\n**For example:**\n\n bean.setPayerId(bean.getPayerId());\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "PropertyValueSetToItself",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/JavaBeans issues",
"index": 138,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassInitializer",
"shortDescription": {
"text": "Non-'static' initializer"
},
"fullDescription": {
"text": "Reports non-'static' initializers in classes. Some coding standards prohibit instance initializers and recommend using constructors or field initializers for initialization. Also, deleting the 'static' keyword may accidentally create non-'static' initializers and result in obscure bugs. This inspection doesn't report instance initializers in anonymous classes. Use the Only warn when the class has one or more constructors option to ignore instance initializers in classes that don't have any constructors.",
"markdown": "Reports non-`static` initializers in classes.\n\nSome coding standards prohibit instance initializers and recommend using constructors or field initializers for initialization.\nAlso, deleting the `static` keyword may accidentally create non-`static` initializers and result in obscure bugs.\n\nThis inspection doesn't report instance initializers in anonymous classes.\n\n\nUse the **Only warn when the class has one or more constructors** option to ignore instance initializers in classes that don't have any constructors."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonStaticInitializer",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ContinueOrBreakFromFinallyBlock",
"shortDescription": {
"text": "'continue' or 'break' inside 'finally' block"
},
"fullDescription": {
"text": "Reports 'break' or 'continue' statements inside of 'finally' blocks. While occasionally intended, such statements are very confusing, may mask thrown exceptions, and complicate debugging. Example: 'while (true) {\n try {\n throwingMethod();\n } finally {\n continue;\n }\n }'",
"markdown": "Reports `break` or `continue` statements inside of `finally` blocks.\n\nWhile occasionally intended, such statements are very confusing, may mask thrown exceptions, and complicate debugging.\n\n**Example:**\n\n\n while (true) {\n try {\n throwingMethod();\n } finally {\n continue;\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ContinueOrBreakFromFinallyBlock",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LengthOneStringsInConcatenation",
"shortDescription": {
"text": "Single character string concatenation"
},
"fullDescription": {
"text": "Reports concatenation with string literals that consist of one character. These literals may be replaced with equivalent character literals, gaining some performance enhancement. Example: 'String hello = hell + \"o\";' After the quick-fix is applied: 'String hello = hell + 'o';'",
"markdown": "Reports concatenation with string literals that consist of one character.\n\nThese literals may be replaced with equivalent character literals, gaining some performance enhancement.\n\n**Example:**\n\n\n String hello = hell + \"o\";\n\nAfter the quick-fix is applied:\n\n\n String hello = hell + 'o';\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "SingleCharacterStringConcatenation",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassWithTooManyTransitiveDependencies",
"shortDescription": {
"text": "Class with too many transitive dependencies"
},
"fullDescription": {
"text": "Reports classes that are directly or indirectly dependent on too many other classes. Modifications to any dependency of such a class may require changing the class thus making it prone to instability. Only top-level classes are reported. Use the Maximum number of transitive dependencies field to specify the maximum allowed number of direct or indirect dependencies for a class. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.",
"markdown": "Reports classes that are directly or indirectly dependent on too many other classes.\n\nModifications to any dependency of such a class may require changing the class thus making it prone to instability.\n\nOnly top-level classes are reported.\n\nUse the **Maximum number of transitive dependencies** field to specify the maximum allowed number of direct or indirect dependencies\nfor a class.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassWithTooManyTransitiveDependencies",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Dependency issues",
"index": 142,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryThis",
"shortDescription": {
"text": "Unnecessary 'this' qualifier"
},
"fullDescription": {
"text": "Reports unnecessary 'this' qualifier. Using 'this' to disambiguate a code reference is discouraged by many coding styles and may easily become unnecessary via automatic refactorings. Example: 'class Foo {\n int x;\n void foo() {\n this.x = 2;\n }\n }' After the quick-fix is applied: 'class Foo {\n int x;\n void foo() {\n x = 2;\n }\n }' Use the inspection settings to ignore assignments to fields. For instance, 'this.x = 2;' won't be reported, but 'int y = this.x;' will be.",
"markdown": "Reports unnecessary `this` qualifier.\n\n\nUsing `this` to disambiguate a code reference is discouraged by many coding styles\nand may easily become unnecessary\nvia automatic refactorings.\n\n**Example:**\n\n\n class Foo {\n int x;\n void foo() {\n this.x = 2;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n int x;\n void foo() {\n x = 2;\n }\n }\n\n\nUse the inspection settings to ignore assignments to fields.\nFor instance, `this.x = 2;` won't be reported, but `int y = this.x;` will be."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryThis",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LoopWithImplicitTerminationCondition",
"shortDescription": {
"text": "Loop with implicit termination condition"
},
"fullDescription": {
"text": "Reports any 'while', 'do-while', and 'for' loops that have the 'true' constant as their only condition. At the same time, such loops can be still terminated by a containing 'if' statement which can break out of the loop. Such an 'if' statement must be the first or the only statement in a 'while' or 'for' loop and the last or the only statement in a 'do-while' loop. Removing the 'if' statement and making its condition an explicit loop condition simplifies the loop.",
"markdown": "Reports any `while`, `do-while`, and `for` loops that have the `true` constant as their only condition. At the same time, such loops can be still terminated by a containing `if` statement which can break out of the loop.\n\nSuch an `if` statement must be the first or the only statement\nin a `while` or `for`\nloop and the last or the only statement in a `do-while` loop.\n\nRemoving the `if` statement and making its condition an explicit\nloop condition simplifies the loop."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "LoopWithImplicitTerminationCondition",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ExplicitArrayFilling",
"shortDescription": {
"text": "Explicit array filling"
},
"fullDescription": {
"text": "Reports loops that can be replaced with 'Arrays.setAll()' or 'Arrays.fill()' calls. This inspection suggests replacing loops with 'Arrays.setAll()' if the language level of the project or module is 8 or higher. Replacing loops with 'Arrays.fill()' is possible with any language level. Example: 'for (int i=0; i<array.length; i++) {\n array[i] = calc(i);\n }' After the quick-fix is applied: 'Arrays.setAll(array, this::calc);' New in 2017.1",
"markdown": "Reports loops that can be replaced with `Arrays.setAll()` or `Arrays.fill()` calls.\n\nThis inspection suggests replacing loops with `Arrays.setAll()` if the language level of the project or module is 8 or higher.\nReplacing loops with `Arrays.fill()` is possible with any language level.\n\nExample:\n\n\n for (int i=0; i<array.length; i++) {\n array[i] = calc(i);\n }\n\nAfter the quick-fix is applied:\n\n\n Arrays.setAll(array, this::calc);\n\nNew in 2017.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ExplicitArrayFilling",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "BadExceptionDeclared",
"shortDescription": {
"text": "Prohibited exception declared"
},
"fullDescription": {
"text": "Reports methods that declare an inappropriate exception in their 'throws' clause. For example an exception can be inappropriate because it is overly generic, such as 'java.lang.Exception' or 'java.lang.Throwable'. Example: 'void describeModule(String module) throws Exception {} // warning: Prohibited exception 'Exception' declared' Configure the inspection: Use the Prohibited exceptions list to specify which exceptions should be reported. Use the Ignore exceptions declared on methods overriding a library method option to ignore exceptions declared by methods that override a library method.",
"markdown": "Reports methods that declare an inappropriate exception in their `throws` clause. For example an exception can be inappropriate because it is overly generic, such as `java.lang.Exception` or `java.lang.Throwable`.\n\n**Example:**\n\n\n void describeModule(String module) throws Exception {} // warning: Prohibited exception 'Exception' declared\n\nConfigure the inspection:\n\n* Use the **Prohibited exceptions** list to specify which exceptions should be reported.\n* Use the **Ignore exceptions declared on methods overriding a library method** option to ignore exceptions declared by methods that override a library method."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ProhibitedExceptionDeclared",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "IntegerMultiplicationImplicitCastToLong",
"shortDescription": {
"text": "Integer multiplication or shift implicitly cast to 'long'"
},
"fullDescription": {
"text": "Reports integer multiplications and left shifts that are implicitly cast to long. Example: 'void f(int i) {\n long val = 65536 * i;\n }' After the quick-fix is applied, the code changes to: 'void x(int i) {\n long val = 65536L * i;\n }' Example: 'void f(int i) {\n long value = i << 24;\n }' After the quick-fix is applied, the code changes to: 'void f(int i) {\n long value = (long) i << 24;\n }' Such multiplications are often a mistake, as overflow truncation may occur unexpectedly. Converting an 'int' literal to a 'long' literal ('65536L') fixes the problem.",
"markdown": "Reports integer multiplications and left shifts that are implicitly cast to long.\n\n**Example:**\n\n\n void f(int i) {\n long val = 65536 * i;\n }\n\nAfter the quick-fix is applied, the code changes to:\n\n\n void x(int i) {\n long val = 65536L * i;\n }\n\n**Example:**\n\n\n void f(int i) {\n long value = i << 24;\n }\n\nAfter the quick-fix is applied, the code changes to:\n\n\n void f(int i) {\n long value = (long) i << 24;\n }\n\n\nSuch multiplications are often a mistake, as overflow truncation may occur unexpectedly.\nConverting an `int` literal to a `long` literal (`65536`**L**) fixes the problem."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "IntegerMultiplicationImplicitCastToLong",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues/Cast",
"index": 136,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ReplaceAssignmentWithOperatorAssignment",
"shortDescription": {
"text": "Assignment can be replaced with operator assignment"
},
"fullDescription": {
"text": "Reports assignment operations which can be replaced by operator-assignment. Code using operator assignment is shorter and may be clearer. Example: 'x = x + 3;\n x = x / 3;' After the quick fix is applied: 'x += 3;\n x /= 3;' Use the Ignore conditional operators option to ignore '&&' and '||'. Replacing conditional operators with operator assignment would change the evaluation from lazy to eager, which may change the semantics of the expression. Use the Ignore obscure operators option to ignore '^' and '%', which are less known.",
"markdown": "Reports assignment operations which can be replaced by operator-assignment.\n\nCode using operator assignment is shorter and may be clearer.\n\n**Example:**\n\n x = x + 3;\n x = x / 3;\n\nAfter the quick fix is applied:\n\n x += 3;\n x /= 3;\n\n\nUse the **Ignore conditional operators** option to ignore `&&`\nand `||`. Replacing conditional operators with operator\nassignment would change the evaluation from lazy to eager, which may change the semantics of the expression.\n\n\nUse the **Ignore obscure operators** option to ignore `^` and `%`, which are less known."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "AssignmentReplaceableWithOperatorAssignment",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Assignment issues",
"index": 87,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ReturnFromFinallyBlock",
"shortDescription": {
"text": "'return' inside 'finally' block"
},
"fullDescription": {
"text": "Reports 'return' statements inside of 'finally' blocks. While occasionally intended, such 'return' statements may mask thrown exceptions and complicate debugging. Example: 'try {\n foo();\n } finally {\n if (bar()) return;\n }'",
"markdown": "Reports `return` statements inside of `finally` blocks.\n\nWhile occasionally intended, such `return` statements may mask thrown exceptions\nand complicate debugging.\n\n**Example:**\n\n\n try {\n foo();\n } finally {\n if (bar()) return;\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ReturnInsideFinallyBlock",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RedundantExplicitClose",
"shortDescription": {
"text": "Redundant 'close()'"
},
"fullDescription": {
"text": "Reports unnecessary calls to 'close()' at the end of a try-with-resources block and suggests removing them. Example: 'try(MyAutoCloseable ac = new MyAutoCloseable()) {\n foo();\n ac.close();\n }' After the quick-fix is applied: 'try(MyAutoCloseable ac = new MyAutoCloseable()) {\n foo();\n }' New in 2018.1",
"markdown": "Reports unnecessary calls to `close()` at the end of a try-with-resources block and suggests removing them.\n\n**Example**:\n\n\n try(MyAutoCloseable ac = new MyAutoCloseable()) {\n foo();\n ac.close();\n }\n\nAfter the quick-fix is applied:\n\n\n try(MyAutoCloseable ac = new MyAutoCloseable()) {\n foo();\n }\n\nNew in 2018.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "RedundantExplicitClose",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Declaration redundancy",
"index": 12,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AssertStatement",
"shortDescription": {
"text": "'assert' statement"
},
"fullDescription": {
"text": "Reports 'assert' statements. By default, 'assert' statements are disabled during execution in the production environment. Consider using logger or exceptions instead. The 'assert' statements are not supported in Java 1.3 and earlier JVM.",
"markdown": "Reports `assert` statements. By default, `assert` statements are disabled during execution in the production environment. Consider using logger or exceptions instead.\n\nThe `assert` statements are not supported in Java 1.3 and earlier JVM."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AssertStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level issues",
"index": 143,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessarySemicolon",
"shortDescription": {
"text": "Unnecessary semicolon"
},
"fullDescription": {
"text": "Reports any unnecessary semicolons, including semicolons that are used between class members, inside block statements, or after class definitions. Even though these semicolons are valid in Java, they are redundant and may be removed. Example: 'class C {\n ;\n void m() throws Exception {\n try (AutoCloseable r1 = createAutoCloseable();) {\n ;\n }\n }\n ;\n }' After the quick-fix is applied: 'class C {\n void m() throws Exception {\n try (AutoCloseable r1 = createAutoCloseable()) {\n }\n }\n }'",
"markdown": "Reports any unnecessary semicolons, including semicolons that are used between class members, inside block statements, or after class definitions.\n\nEven though these semicolons are valid in Java, they are redundant and may be removed.\n\nExample:\n\n\n class C {\n ;\n void m() throws Exception {\n try (AutoCloseable r1 = createAutoCloseable();) {\n ;\n }\n }\n ;\n }\n\nAfter the quick-fix is applied:\n\n\n class C {\n void m() throws Exception {\n try (AutoCloseable r1 = createAutoCloseable()) {\n }\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessarySemicolon",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AssertEqualsMayBeAssertSame",
"shortDescription": {
"text": "'assertEquals()' may be 'assertSame()'"
},
"fullDescription": {
"text": "Reports JUnit 'assertEquals()' calls that can be replaced with an equivalent 'assertSame()' call. This is possible when the arguments are instances of a 'final' class that does not override the 'Object.equals()' method and makes it explicit that the object identity is compared. Suggests replacing 'assertEquals()' with 'assertSame()'. Example: '@Test\n public void testObjectType() {\n Object o = getObject();\n Assert.assertEquals(String.class, o.getClass());\n }' After the quick fix is applied: '@Test\n public void testSort() {\n Object o = getObject();\n Assert.assertSame(String.class, o.getClass());\n }'",
"markdown": "Reports JUnit `assertEquals()` calls that can be replaced with an equivalent `assertSame()` call. This is possible when the arguments are instances of a `final` class that does not override the `Object.equals()` method and makes it explicit that the object identity is compared.\n\nSuggests replacing `assertEquals()` with `assertSame()`.\n\n**Example:**\n\n\n @Test\n public void testObjectType() {\n Object o = getObject();\n Assert.assertEquals(String.class, o.getClass());\n }\n\nAfter the quick fix is applied:\n\n\n @Test\n public void testSort() {\n Object o = getObject();\n Assert.assertSame(String.class, o.getClass());\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AssertEqualsMayBeAssertSame",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Test frameworks",
"index": 121,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavadocBlankLines",
"shortDescription": {
"text": "Blank line should be replaced with <p> to break lines"
},
"fullDescription": {
"text": "Reports blank lines in Javadoc comments. Blank lines in Javadoc may signal an intention split the text to different paragraphs. However, the Javadoc tool and IntelliJ IDEA will ignore them when rendering documentation comments. The quick-fix suggests to replace the blank line with a paragraph tag (<p>). Example: 'class Main {\n /**\n * Doesn't do anything.\n *\n * Does absolutely nothing\n */\n void foo() {}\n }' After the quick-fix is applied: 'class Main {\n /**\n * Doesn't do anything.\n * <p>\n * Does absolutely nothing\n */\n void foo() {}\n }' New in 2022.1",
"markdown": "Reports blank lines in Javadoc comments.\n\n\nBlank lines in Javadoc may signal an intention split the text to different paragraphs. However, the Javadoc tool and IntelliJ IDEA will\nignore them when rendering documentation comments.\n\n\nThe quick-fix suggests to replace the blank line with a paragraph tag (\\<p\\>).\n\n**Example:**\n\n\n class Main {\n /**\n * Doesn't do anything.\n *\n * Does absolutely nothing\n */\n void foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class Main {\n /**\n * Doesn't do anything.\n * <p>\n * Does absolutely nothing\n */\n void foo() {}\n }\n\nNew in 2022.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "JavadocBlankLines",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Javadoc",
"index": 79,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TypeParameterExtendsFinalClass",
"shortDescription": {
"text": "Type parameter extends 'final' class"
},
"fullDescription": {
"text": "Reports type parameters declared to extend a 'final' class. Suggests replacing the type parameter with the type of the specified 'final' class since 'final' classes cannot be extended. Example: 'void foo() {\n List<? extends Integer> list; // Warning: the Integer class is a final class\n }' After the quick-fix is applied: 'void foo() {\n List<Integer> list;\n }'",
"markdown": "Reports type parameters declared to extend a `final` class.\n\nSuggests replacing the type parameter with the type of the specified `final` class since\n`final` classes cannot be extended.\n\n**Example:**\n\n\n void foo() {\n List<? extends Integer> list; // Warning: the Integer class is a final class\n }\n\nAfter the quick-fix is applied:\n\n\n void foo() {\n List<Integer> list;\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "TypeParameterExtendsFinalClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Inheritance issues",
"index": 147,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UtilityClassWithPublicConstructor",
"shortDescription": {
"text": "Utility class with 'public' constructor"
},
"fullDescription": {
"text": "Reports utility classes with 'public' constructors. Utility classes have all fields and methods declared as 'static'. Creating a 'public' constructor in such classes is confusing and may cause accidental class instantiation. Example: 'public final class UtilityClass {\n public UtilityClass(){\n }\n public static void foo() {}\n }' After the quick-fix is applied: 'public final class UtilityClass {\n private UtilityClass(){\n }\n public static void foo() {}\n }'",
"markdown": "Reports utility classes with `public` constructors.\n\nUtility classes have all fields and methods declared as `static`. Creating a `public`\nconstructor in such classes is confusing and may cause accidental class instantiation.\n\n**Example:**\n\n\n public final class UtilityClass {\n public UtilityClass(){\n }\n public static void foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n public final class UtilityClass {\n private UtilityClass(){\n }\n public static void foo() {}\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UtilityClassWithPublicConstructor",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TrivialIf",
"shortDescription": {
"text": "Redundant 'if' statement"
},
"fullDescription": {
"text": "Reports 'if' statements that can be simplified to a single assignment, 'return', or 'assert' statement. Example: 'if (foo()) {\n return true;\n } else {\n return false;\n }' After the quick-fix is applied: 'return foo();' Configure the inspection: Use the Ignore chained 'if' statements option if you want to hide a warning for chained 'if' statements. For example, in the following code the warning will be hidden, but the quick-fix will still be available: 'if (condition1) return true;\n if (condition2) return false;\n return true;' Note that replacing 'if (isTrue()) assert false;' with 'assert isTrue();' may change the program semantics when asserts are disabled if condition has side effects. Use the Ignore 'if' statements with trivial 'assert' option if you want to hide a warning for 'if' statements containing only 'assert' statement in their bodies.",
"markdown": "Reports `if` statements that can be simplified to a single assignment, `return`, or `assert` statement.\n\nExample:\n\n\n if (foo()) {\n return true;\n } else {\n return false;\n }\n\nAfter the quick-fix is applied:\n\n\n return foo();\n\nConfigure the inspection:\n\nUse the **Ignore chained 'if' statements** option if you want to hide a warning for chained `if` statements.\n\nFor example, in the following code the warning will be hidden, but the quick-fix will still be available:\n\n\n if (condition1) return true;\n if (condition2) return false;\n return true;\n\nNote that replacing `if (isTrue()) assert false;` with `assert isTrue();` may change the program semantics\nwhen asserts are disabled if condition has side effects.\nUse the **Ignore 'if' statements with trivial 'assert'** option if you want to hide a warning for `if` statements\ncontaining only `assert` statement in their bodies."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "RedundantIfStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "BooleanMethodIsAlwaysInverted",
"shortDescription": {
"text": "Boolean method is always inverted"
},
"fullDescription": {
"text": "Reports methods with a 'boolean' return type that are always negated when called. A quick-fix is provided to invert and optionally rename the method. For performance reasons, not all problematic methods may be highlighted in the editor. Example: 'class C {\n boolean alwaysTrue() {\n return true;\n }\n\n void f() {\n if (!alwaysTrue()) {\n return;\n }\n }\n boolean member = !alwaysTrue();\n }' After the quick-fix is applied: 'class C {\n boolean alwaysFalse() {\n return false;\n }\n\n void f() {\n if (alwaysFalse()) {\n return;\n }\n }\n boolean member = alwaysFalse();\n }'",
"markdown": "Reports methods with a `boolean` return type that are always negated when called.\n\nA quick-fix is provided to invert and optionally rename the method.\nFor performance reasons, not all problematic methods may be highlighted in the editor.\n\nExample:\n\n\n class C {\n boolean alwaysTrue() {\n return true;\n }\n\n void f() {\n if (!alwaysTrue()) {\n return;\n }\n }\n boolean member = !alwaysTrue();\n }\n\nAfter the quick-fix is applied:\n\n\n class C {\n boolean alwaysFalse() {\n return false;\n }\n\n void f() {\n if (alwaysFalse()) {\n return;\n }\n }\n boolean member = alwaysFalse();\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "BooleanMethodIsAlwaysInverted",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Data flow",
"index": 65,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InstanceGuardedByStatic",
"shortDescription": {
"text": "Instance member guarded by static field"
},
"fullDescription": {
"text": "Reports '@GuardedBy' annotations on instance fields or methods in which the guard is a 'static' field. Guarding a non-static by a static may result in excessive lock contention, as access to each locked field in any object instance will prevent simultaneous access to that field in every object instance. Example: 'private static ReadWriteLock lock = new ReentrantReadWriteLock(); //static guarding field\n private Object state;\n\n @GuardedBy(\"lock\")\n public void bar() {\n state = new Object();\n }' Supported '@GuardedBy' annotations are: 'net.jcip.annotations.GuardedBy' 'javax.annotation.concurrent.GuardedBy' 'org.apache.http.annotation.GuardedBy' 'com.android.annotations.concurrency.GuardedBy' 'androidx.annotation.GuardedBy' 'com.google.errorprone.annotations.concurrent.GuardedBy'",
"markdown": "Reports `@GuardedBy` annotations on instance fields or methods in which the guard is a `static` field. Guarding a non-static by a static may result in excessive lock contention, as access to each locked field in any object instance will prevent simultaneous access to that field in every object instance.\n\nExample:\n\n\n private static ReadWriteLock lock = new ReentrantReadWriteLock(); //static guarding field\n private Object state;\n\n @GuardedBy(\"lock\")\n public void bar() {\n state = new Object();\n }\n\nSupported `@GuardedBy` annotations are:\n\n* `net.jcip.annotations.GuardedBy`\n* `javax.annotation.concurrent.GuardedBy`\n* `org.apache.http.annotation.GuardedBy`\n* `com.android.annotations.concurrency.GuardedBy`\n* `androidx.annotation.GuardedBy`\n* `com.google.errorprone.annotations.concurrent.GuardedBy`"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "InstanceGuardedByStatic",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Concurrency annotation issues",
"index": 101,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AutoCloseableResource",
"shortDescription": {
"text": "AutoCloseable used without 'try'-with-resources"
},
"fullDescription": {
"text": "Reports 'AutoCloseable' instances which are not used in a try-with-resources statement, also known as Automatic Resource Management. This means that the \"open resource before/in 'try', close in 'finally'\" style that had been used before try-with-resources became available, is also reported. This inspection is meant to replace all opened but not safely closed inspections when developing in Java 7 and higher. Example: 'private static void foo() throws IOException {\n InputStream profile = Thread.currentThread().getContextClassLoader().getResourceAsStream(\"/someFile\");\n System.out.println(profile.read());\n }' Use the following options to configure the inspection: List subclasses of 'AutoCloseable' that do not need to be closed and should be ignored by this inspection. Note: The inspection will still report streams returned from the 'java.nio.file.Files' methods 'lines()', 'walk()', 'list()' and 'find()', even when 'java.util.stream.Stream' is listed to be ignored. These streams contain an associated I/O resource that needs to be closed. List methods returning 'AutoCloseable' that should be ignored when called. Whether to ignore an 'AutoCloseable' if it is the result of a method call. When this option is enabled, the results of factory methods will also be ignored. Whether the inspection should report if an 'AutoCloseable' instance is passed as a method call argument. If this option is enabled, the inspection assumes the resource is closed in the called method. Method calls inside a 'finally' block with 'close' in the name and an 'AutoCloseable' argument will not be ignored. Whether to ignore method references to constructors of resource classes. Whether to ignore methods that return a resource and whose name starts with 'get'. This can reduce false positives because most of the getters do not transfer the ownership of the resource, and their call sites are not responsible for closing the resource.",
"markdown": "Reports `AutoCloseable` instances which are not used in a try-with-resources statement, also known as *Automatic Resource Management* .\n\n\nThis means that the \"open resource before/in `try`, close in `finally`\" style that had been used before\ntry-with-resources became available, is also reported.\nThis inspection is meant to replace all *opened but not safely closed* inspections when developing in Java 7 and higher.\n\n**Example:**\n\n\n private static void foo() throws IOException {\n InputStream profile = Thread.currentThread().getContextClassLoader().getResourceAsStream(\"/someFile\");\n System.out.println(profile.read());\n }\n\n\nUse the following options to configure the inspection:\n\n* List subclasses of `AutoCloseable` that do not need to be closed and should be ignored by this inspection. \n **Note** : The inspection will still report streams returned from the `java.nio.file.Files` methods `lines()`, `walk()`, `list()` and `find()`, even when `java.util.stream.Stream` is listed to be ignored. These streams contain an associated I/O resource that needs to be closed.\n* List methods returning `AutoCloseable` that should be ignored when called.\n* Whether to ignore an `AutoCloseable` if it is the result of a method call. When this option is enabled, the results of factory methods will also be ignored.\n* Whether the inspection should report if an `AutoCloseable` instance is passed as a method call argument. If this option is enabled, the inspection assumes the resource is closed in the called method. Method calls inside a `finally` block with 'close' in the name and an `AutoCloseable` argument will not be ignored.\n* Whether to ignore method references to constructors of resource classes.\n* Whether to ignore methods that return a resource and whose name starts with 'get'. This can reduce false positives because most of the getters do not transfer the ownership of the resource, and their call sites are not responsible for closing the resource."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "resource",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Resource management",
"index": 133,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SingleStatementInBlock",
"shortDescription": {
"text": "Code block contains single statement"
},
"fullDescription": {
"text": "Reports control flow statements with a single statement in their code block and suggests removing the braces from the control flow statement body. Example: 'if (x > 0) {\n System.out.println(\"x is positive\");\n }' After the quick-fix is applied: 'if (x > 0) System.out.println(\"x is positive\");'",
"markdown": "Reports control flow statements with a single statement in their code block and suggests removing the braces from the control flow statement body.\n\nExample:\n\n\n if (x > 0) {\n System.out.println(\"x is positive\");\n }\n\nAfter the quick-fix is applied:\n\n\n if (x > 0) System.out.println(\"x is positive\");\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "SingleStatementInBlock",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TestCaseWithConstructor",
"shortDescription": {
"text": "TestCase with non-trivial constructors"
},
"fullDescription": {
"text": "Reports test cases with initialization logic in their constructors. If a constructor fails, the '@After' annotated or 'tearDown()' method won't be called. This can leave the test environment partially initialized, which can adversely affect other tests. Instead, initialization of test cases should be done in a 'setUp()' or '@Before' annotated method. Bad example: 'public class ImportantTest {\n private File file;\n\n public ImportantTest() throws IOException {\n file = File.createTempFile(\"xyz\", \".tmp\");\n }\n\n // ... tests go here\n }'",
"markdown": "Reports test cases with initialization logic in their constructors. If a constructor fails, the `@After` annotated or `tearDown()` method won't be called. This can leave the test environment partially initialized, which can adversely affect other tests. Instead, initialization of test cases should be done in a `setUp()` or `@Before` annotated method.\n\nBad example:\n\n\n public class ImportantTest {\n private File file;\n\n public ImportantTest() throws IOException {\n file = File.createTempFile(\"xyz\", \".tmp\");\n }\n\n // ... tests go here\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "JUnitTestCaseWithNonTrivialConstructors",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Test frameworks",
"index": 121,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ReadObjectAndWriteObjectPrivate",
"shortDescription": {
"text": "'readObject()' or 'writeObject()' not declared 'private'"
},
"fullDescription": {
"text": "Reports 'Serializable' classes where the 'readObject' or 'writeObject' methods are not declared private. There is no reason these methods should ever have a higher visibility than 'private'. A quick-fix is suggested to make the corresponding method 'private'. Example: 'public class Test implements Serializable {\n public void readObject(ObjectInputStream stream) {\n /* ... */\n }\n }' After the quick-fix is applied: 'public class Test implements Serializable {\n private void readObject(ObjectInputStream stream) {\n /* ... */\n }\n }'",
"markdown": "Reports `Serializable` classes where the `readObject` or `writeObject` methods are not declared private. There is no reason these methods should ever have a higher visibility than `private`.\n\n\nA quick-fix is suggested to make the corresponding method `private`.\n\n**Example:**\n\n\n public class Test implements Serializable {\n public void readObject(ObjectInputStream stream) {\n /* ... */\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Test implements Serializable {\n private void readObject(ObjectInputStream stream) {\n /* ... */\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonPrivateSerializationMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Serialization issues",
"index": 20,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RedundantFileCreation",
"shortDescription": {
"text": "Redundant 'File' instance creation"
},
"fullDescription": {
"text": "Reports redundant 'File' creation in one of the following constructors when only 'String' path can be used: 'FileInputStream', 'FileOutputStream', 'FileReader', 'FileWriter', 'PrintStream', 'PrintWriter', 'Formatter'. Example: 'InputStream is = new FileInputStream(new File(\"in.txt\"));' After quick-fix is applied: 'InputStream is = new FileInputStream(\"in.txt\");' New in 2020.3",
"markdown": "Reports redundant `File` creation in one of the following constructors when only `String` path can be used: `FileInputStream`, `FileOutputStream`, `FileReader`, `FileWriter`, `PrintStream`, `PrintWriter`, `Formatter`.\n\nExample:\n\n\n InputStream is = new FileInputStream(new File(\"in.txt\"));\n\nAfter quick-fix is applied:\n\n\n InputStream is = new FileInputStream(\"in.txt\");\n\nNew in 2020.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "RedundantFileCreation",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SuperTearDownInFinally",
"shortDescription": {
"text": "JUnit 3 'super.tearDown()' is not called from 'finally' block"
},
"fullDescription": {
"text": "Reports calls of the JUnit 3's 'super.tearDown()' method that are not performed inside a 'finally' block. If an exception is thrown before 'super.tearDown()' is called it could lead to inconsistencies and leaks. Example: 'public class AnotherTest extends CompanyTestCase {\n private Path path;\n\n @Override\n protected void setUp() throws Exception {\n super.setUp();\n path = Files.createTempFile(\"File\", \".tmp\");\n }\n\n @Override\n protected void tearDown() throws Exception {\n Files.delete(path);\n super.tearDown();\n }\n }' Improved code: 'public class AnotherTest extends CompanyTestCase {\n private Path path;\n\n @Override\n protected void setUp() throws Exception {\n super.setUp();\n path = Files.createTempFile(\"File\", \".tmp\");\n }\n\n @Override\n protected void tearDown() throws Exception {\n try {\n Files.delete(path);\n } finally {\n super.tearDown();\n }\n }\n }'",
"markdown": "Reports calls of the JUnit 3's `super.tearDown()` method that are not performed inside a `finally` block. If an exception is thrown before `super.tearDown()` is called it could lead to inconsistencies and leaks.\n\n**Example:**\n\n\n public class AnotherTest extends CompanyTestCase {\n private Path path;\n\n @Override\n protected void setUp() throws Exception {\n super.setUp();\n path = Files.createTempFile(\"File\", \".tmp\");\n }\n\n @Override\n protected void tearDown() throws Exception {\n Files.delete(path);\n super.tearDown();\n }\n }\n\nImproved code:\n\n\n public class AnotherTest extends CompanyTestCase {\n private Path path;\n\n @Override\n protected void setUp() throws Exception {\n super.setUp();\n path = Files.createTempFile(\"File\", \".tmp\");\n }\n\n @Override\n protected void tearDown() throws Exception {\n try {\n Files.delete(path);\n } finally {\n super.tearDown();\n }\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SuperTearDownInFinally",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Test frameworks",
"index": 121,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PointlessBooleanExpression",
"shortDescription": {
"text": "Pointless boolean expression"
},
"fullDescription": {
"text": "Reports unnecessary or overly complicated boolean expressions. Such expressions include '&&'-ing with 'true', '||'-ing with 'false', equality comparison with a boolean literal, or negation of a boolean literal. Such expressions can be simplified. Example: 'boolean a = !(x && false);\n boolean b = false || x;\n boolean c = x != true;' After the quick-fix is applied: 'boolean a = true;\n boolean b = x;\n boolean c = !x;' Configure the inspection: Use the Ignore named constants in determining pointless expressions option to ignore named constants when determining if an expression is pointless.",
"markdown": "Reports unnecessary or overly complicated boolean expressions.\n\nSuch expressions include `&&`-ing with `true`,\n`||`-ing with `false`,\nequality comparison with a boolean literal, or negation of a boolean literal. Such expressions can be simplified.\n\nExample:\n\n\n boolean a = !(x && false);\n boolean b = false || x;\n boolean c = x != true;\n\nAfter the quick-fix is applied:\n\n\n boolean a = true;\n boolean b = x;\n boolean c = !x;\n\n\nConfigure the inspection:\nUse the **Ignore named constants in determining pointless expressions** option to ignore named constants when determining if an expression is pointless."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "PointlessBooleanExpression",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ListenerMayUseAdapter",
"shortDescription": {
"text": "Class may extend adapter instead of implementing listener"
},
"fullDescription": {
"text": "Reports classes implementing listeners instead of extending corresponding adapters. A quick-fix is available to remove any redundant empty methods left after replacing a listener implementation with an adapter extension. Use the Only warn when empty implementing methods are found option to configure the inspection to warn even if no empty methods are found.",
"markdown": "Reports classes implementing listeners instead of extending corresponding adapters.\n\nA quick-fix is available to\nremove any redundant empty methods left after replacing a listener implementation with an adapter extension.\n\n\nUse the **Only warn when empty implementing methods are found** option to configure the inspection to warn even if no empty methods are found."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ListenerMayUseAdapter",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RefusedBequest",
"shortDescription": {
"text": "Method does not call super method"
},
"fullDescription": {
"text": "Reports methods that override a super method without calling it. This is also known as a refused bequest. Such methods may represent a failure of abstraction and cause hard-to-trace bugs. The inspection doesn't report methods overridden from 'java.lang.Object', except for 'clone()'. The 'clone()' method should by convention call its super method, which will return an object of the correct type. Example 1: 'class A {\n @Override\n public Object clone() {\n // does not call 'super.clone()'\n return new A();\n }\n }' Example 2: 'interface I {\n default void foo() {}\n }\n\n class A implements I {\n // warning on method when\n // 'Ignore 'default' super methods' is disabled\n @Override\n public void foo(){}\n }' Configure the inspection: Use the Only report when super method is annotated by option to ignore super methods marked with the annotations from the provided list. You can manually add annotations to the list. Use the Ignore empty super methods option to ignore super methods that are either empty or only throw an exception. Use the Ignore 'default' super methods option to ignore 'default' super methods from interfaces.",
"markdown": "Reports methods that override a super method without calling it. This is also known as a *refused bequest* . Such methods may represent a failure of abstraction and cause hard-to-trace bugs.\n\n\nThe inspection doesn't report methods overridden from `java.lang.Object`, except for `clone()`.\nThe `clone()` method should by convention call its super method,\nwhich will return an object of the correct type.\n\n**Example 1:**\n\n\n class A {\n @Override\n public Object clone() {\n // does not call 'super.clone()'\n return new A();\n }\n }\n\n**Example 2:**\n\n\n interface I {\n default void foo() {}\n }\n\n class A implements I {\n // warning on method when\n // 'Ignore 'default' super methods' is disabled\n @Override\n public void foo(){}\n }\n\nConfigure the inspection:\n\n* Use the **Only report when super method is annotated by** option to ignore super methods marked with the annotations from the provided list. You can manually add annotations to the list.\n* Use the **Ignore empty super methods** option to ignore super methods that are either empty or only throw an exception.\n* Use the **Ignore 'default' super methods** option to ignore `default` super methods from interfaces."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "MethodDoesntCallSuperMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Inheritance issues",
"index": 147,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryReturn",
"shortDescription": {
"text": "Unnecessary 'return' statement"
},
"fullDescription": {
"text": "Reports 'return' statements at the end of constructors and methods returning 'void'. These statements are redundant and may be safely removed. This inspection does not report in JSP files. Example: 'void message() {\n System.out.println(\"Hello World\");\n return;\n }' After the quick-fix is applied: 'void message() {\n System.out.println(\"Hello World\");\n }' Use the Ignore in then branch of 'if' statement with 'else' branch option to ignore 'return' statements in the then branch of 'if' statements which also have an 'else' branch.",
"markdown": "Reports `return` statements at the end of constructors and methods returning `void`. These statements are redundant and may be safely removed.\n\nThis inspection does not report in JSP files.\n\nExample:\n\n\n void message() {\n System.out.println(\"Hello World\");\n return;\n }\n\nAfter the quick-fix is applied:\n\n\n void message() {\n System.out.println(\"Hello World\");\n }\n\n\nUse the **Ignore in then branch of 'if' statement with 'else' branch** option to ignore `return` statements in the then branch of `if` statements\nwhich also have an `else` branch."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryReturnStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PublicInnerClass",
"shortDescription": {
"text": "'public' nested class"
},
"fullDescription": {
"text": "Reports 'public' nested classes. Example: 'public class Outer {\n public static class Nested {} // warning\n public class Inner {} // warning\n public enum Mode {} // warning depends on the setting\n public interface I {} // warning depends on the setting\n }' Configure the inspection: Use the Ignore 'public' inner enums option to ignore 'public' inner enums. Use the Ignore 'public' inner interfaces option to ignore 'public' inner interfaces.",
"markdown": "Reports `public` nested classes.\n\n**Example:**\n\n\n public class Outer {\n public static class Nested {} // warning\n public class Inner {} // warning\n public enum Mode {} // warning depends on the setting\n public interface I {} // warning depends on the setting\n }\n\nConfigure the inspection:\n\n* Use the **Ignore 'public' inner enums** option to ignore `public` inner enums.\n* Use the **Ignore 'public' inner interfaces** option to ignore `public` inner interfaces."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "PublicInnerClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Encapsulation",
"index": 125,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NonFinalGuard",
"shortDescription": {
"text": "Non-final '@GuardedBy' field"
},
"fullDescription": {
"text": "Reports '@GuardedBy' annotations in which the guarding field is not 'final'. Guarding on a non-final field may result in unexpected race conditions, as locks will be held on the value of the field (which may change), rather than the field itself. Example: 'private ReadWriteLock lock = new ReentrantReadWriteLock(); //not final guarding field\n private Object state;\n\n @GuardedBy(\"lock\")\n public void bar() {\n state = new Object();\n }' Supported '@GuardedBy' annotations are: 'net.jcip.annotations.GuardedBy' 'javax.annotation.concurrent.GuardedBy' 'org.apache.http.annotation.GuardedBy' 'com.android.annotations.concurrency.GuardedBy' 'androidx.annotation.GuardedBy' 'com.google.errorprone.annotations.concurrent.GuardedBy'",
"markdown": "Reports `@GuardedBy` annotations in which the guarding field is not `final`.\n\nGuarding on a non-final field may result in unexpected race conditions, as locks will\nbe held on the value of the field (which may change), rather than the field itself.\n\nExample:\n\n\n private ReadWriteLock lock = new ReentrantReadWriteLock(); //not final guarding field\n private Object state;\n\n @GuardedBy(\"lock\")\n public void bar() {\n state = new Object();\n }\n\nSupported `@GuardedBy` annotations are:\n\n* `net.jcip.annotations.GuardedBy`\n* `javax.annotation.concurrent.GuardedBy`\n* `org.apache.http.annotation.GuardedBy`\n* `com.android.annotations.concurrency.GuardedBy`\n* `androidx.annotation.GuardedBy`\n* `com.google.errorprone.annotations.concurrent.GuardedBy`"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonFinalGuard",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Concurrency annotation issues",
"index": 101,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CollectionAddedToSelf",
"shortDescription": {
"text": "Collection added to itself"
},
"fullDescription": {
"text": "Reports cases where the argument of a method call on a 'java.util.Collection' or 'java.util.Map' is the collection or map itself. Such situations may occur as a result of copy-paste in code with raw types. Example: 'ArrayList list = new ArrayList<>();\n list.add(list); // warning here\n return list.hashCode(); // throws StackOverflowError'",
"markdown": "Reports cases where the argument of a method call on a `java.util.Collection` or `java.util.Map` is the collection or map itself. Such situations may occur as a result of copy-paste in code with raw types.\n\n**Example:**\n\n\n ArrayList list = new ArrayList<>();\n list.add(list); // warning here\n return list.hashCode(); // throws StackOverflowError\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "CollectionAddedToSelf",
"cweIds": [
664,
688
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessarySuperQualifier",
"shortDescription": {
"text": "Unnecessary 'super' qualifier"
},
"fullDescription": {
"text": "Reports unnecessary 'super' qualifiers in method calls and field references. A 'super' qualifier is unnecessary when the field or method of the superclass is not hidden/overridden in the calling class. Example: 'class Foo {\n void foo() {}\n }\n\n class Bar extends Foo {\n void bar() {\n super.foo();\n }\n }' After the quick-fix is applied: 'class Foo {\n void foo() {}\n }\n\n class Bar extends Foo {\n void bar() {\n foo();\n }\n }' Use the inspection settings to ignore qualifiers that help to distinguish superclass members access from the identically named members of the outer class. See also the following inspections: Java | Visibility | Access to inherited field looks like access to element from surrounding code Java | Visibility | Call to inherited method looks like call to local method",
"markdown": "Reports unnecessary `super` qualifiers in method calls and field references.\n\n\nA `super` qualifier is unnecessary\nwhen the field or method of the superclass is not hidden/overridden in the calling class.\n\n**Example:**\n\n\n class Foo {\n void foo() {}\n }\n\n class Bar extends Foo {\n void bar() {\n super.foo();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n void foo() {}\n }\n\n class Bar extends Foo {\n void bar() {\n foo();\n }\n }\n\n\nUse the inspection settings to ignore qualifiers that help to distinguish superclass members access\nfrom the identically named members of the outer class.\n\n\nSee also the following inspections:\n\n* *Java \\| Visibility \\| Access to inherited field looks like access to element from surrounding code*\n* *Java \\| Visibility \\| Call to inherited method looks like call to local method*"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessarySuperQualifier",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "EqualsOnSuspiciousObject",
"shortDescription": {
"text": "'equals()' called on classes which don't override it"
},
"fullDescription": {
"text": "Reports 'equals()' calls on 'StringBuilder', 'StringBuffer' and instances of 'java.util.concurrent.atomic' package. The 'equals()' method is not overridden in these classes, so it may return 'false' even when the contents of the two objects are the same. If the reference equality is intended, it's better to use '==' to avoid confusion. A quick-fix for 'StringBuilder', 'StringBuffer', 'AtomicBoolean', 'AtomicInteger', 'AtomicBoolean' and 'AtomicLong' is available to transform into a comparison of contents. The quick-fix may change the semantics when one of the instances is null. Example: 'public void test(StringBuilder sb1, StringBuilder sb2) {\n boolean result = sb1.equals(sb2); // Suspicious\n }' After the quick-fix is applied: 'public void test(StringBuilder sb1, StringBuilder sb2) {\n boolean result = sb1.toString().equals(sb2.toString());\n }' New in 2017.2",
"markdown": "Reports `equals()` calls on `StringBuilder`, `StringBuffer` and instances of `java.util.concurrent.atomic` package.\n\nThe `equals()` method is not overridden in these classes, so it may return `false` even when the contents of the\ntwo objects are the same.\nIf the reference equality is intended, it's better to use `==` to avoid confusion.\nA quick-fix for `StringBuilder`, `StringBuffer`, `AtomicBoolean`, `AtomicInteger`, `AtomicBoolean` and `AtomicLong` is available to transform into a comparison of contents. The quick-fix may change the semantics when one of the instances is null.\n\nExample:\n\n\n public void test(StringBuilder sb1, StringBuilder sb2) {\n boolean result = sb1.equals(sb2); // Suspicious\n }\n\nAfter the quick-fix is applied:\n\n\n public void test(StringBuilder sb1, StringBuilder sb2) {\n boolean result = sb1.toString().equals(sb2.toString());\n }\n\nNew in 2017.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "EqualsOnSuspiciousObject",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UseOfPropertiesAsHashtable",
"shortDescription": {
"text": "Use of 'Properties' object as a 'Hashtable'"
},
"fullDescription": {
"text": "Reports calls to the following methods on 'java.util.Properties' objects: 'put()' 'putIfAbsent()' 'putAll()' 'get()' For historical reasons, 'java.util.Properties' inherits from 'java.util.Hashtable', but using these methods is discouraged to prevent pollution of properties with values of types other than 'String'. Calls to 'java.util.Properties.putAll()' won't get reported when both the key and the value parameters in the map are of the 'String' type. Such a call is safe and no better alternative exists. Example: 'Object f(Properties props) {\n props.put(\"hello\", \"world\");\n props.putIfAbsent(\"hello\", \"world\");\n props.putAll(new HashMap<>());\n return props.get(\"Hello\");\n }' After the quick-fix is applied: 'Object f(Properties props) {\n props.setProperty(\"hello\", \"world\");\n props.putIfAbsent(\"hello\", \"world\");\n props.putAll(new HashMap<>());\n return props.getProperty(\"hello\");\n }'",
"markdown": "Reports calls to the following methods on `java.util.Properties` objects:\n\n* `put()`\n* `putIfAbsent()`\n* `putAll()`\n* `get()`\n\n\nFor historical reasons, `java.util.Properties` inherits from `java.util.Hashtable`,\nbut using these methods is discouraged to prevent pollution of properties with values of types other than `String`.\n\n\nCalls to `java.util.Properties.putAll()` won't get reported when\nboth the key and the value parameters in the map are of the `String` type.\nSuch a call is safe and no better alternative exists.\n\n**Example:**\n\n\n Object f(Properties props) {\n props.put(\"hello\", \"world\");\n props.putIfAbsent(\"hello\", \"world\");\n props.putAll(new HashMap<>());\n return props.get(\"Hello\");\n }\n\nAfter the quick-fix is applied:\n\n\n Object f(Properties props) {\n props.setProperty(\"hello\", \"world\");\n props.putIfAbsent(\"hello\", \"world\");\n props.putAll(new HashMap<>());\n return props.getProperty(\"hello\");\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UseOfPropertiesAsHashtable",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MethodCoupling",
"shortDescription": {
"text": "Overly coupled method"
},
"fullDescription": {
"text": "Reports methods that reference too many other classes. Methods with too high coupling can be very fragile and should be probably split into smaller methods. Each referenced class is counted only once no matter how many times it is referenced. Configure the inspection: Use the Method coupling limit field to specify the maximum allowed coupling for a method. Use the Include couplings to java system classes option to count references to classes from 'java'or 'javax' packages. Use the Include couplings to library classes option to count references to third-party library classes.",
"markdown": "Reports methods that reference too many other classes. Methods with too high coupling can be very fragile and should be probably split into smaller methods.\n\nEach referenced class is counted only once no matter how many times it is referenced.\n\nConfigure the inspection:\n\n* Use the **Method coupling limit** field to specify the maximum allowed coupling for a method.\n* Use the **Include couplings to java system classes** option to count references to classes from `java`or `javax` packages.\n* Use the **Include couplings to library classes** option to count references to third-party library classes."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OverlyCoupledMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Method metrics",
"index": 132,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AccessToStaticFieldLockedOnInstance",
"shortDescription": {
"text": "Access to 'static' field locked on instance data"
},
"fullDescription": {
"text": "Reports access to non-constant static fields that are locked on either 'this' or an instance field of 'this'. Locking a static field on instance data does not prevent the field from being modified by other instances, and thus may result in unexpected race conditions. Example: 'static String test;\n public void foo() {\n synchronized (this) {\n System.out.println(test); // warning\n }\n }' There is a quick-fix that allows ignoring static fields of specific types. You can manage those ignored types in the inspection options. Use the inspection options to specify which classes used for static fields should be ignored.",
"markdown": "Reports access to non-constant static fields that are locked on either `this` or an instance field of `this`.\n\n\nLocking a static field on instance data does not prevent the field from being\nmodified by other instances, and thus may result in unexpected race conditions.\n\n**Example:**\n\n\n static String test;\n public void foo() {\n synchronized (this) {\n System.out.println(test); // warning\n }\n }\n\n\nThere is a quick-fix that allows ignoring static fields of specific types.\nYou can manage those ignored types in the inspection options.\n\n\nUse the inspection options to specify which classes used for static fields should be ignored."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AccessToStaticFieldLockedOnInstance",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "VariableTypeCanBeExplicit",
"shortDescription": {
"text": "Variable type can be explicit"
},
"fullDescription": {
"text": "Reports local variables of the 'var' type that can be replaced with an explicit type. Example: 'var str = \"Hello\";' After the quick-fix is applied: 'String str = \"Hello\";' 'var' keyword appeared in Java 10. This inspection can help to downgrade for backward compatibility with earlier Java versions.",
"markdown": "Reports local variables of the `var` type that can be replaced with an explicit type.\n\n**Example:**\n\n\n var str = \"Hello\";\n\nAfter the quick-fix is applied:\n\n\n String str = \"Hello\";\n\n\n`var` *keyword* appeared in Java 10.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "VariableTypeCanBeExplicit",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 10",
"index": 157,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java8ListSort",
"shortDescription": {
"text": "'Collections.sort()' can be replaced with 'List.sort()'"
},
"fullDescription": {
"text": "Reports calls of 'Collections.sort(list, comparator)' which can be replaced with 'list.sort(comparator)'. 'Collections.sort' is just a wrapper, so it is better to use an instance method directly. This inspection only reports if the language level of the project or module is 8 or higher.",
"markdown": "Reports calls of `Collections.sort(list, comparator)` which can be replaced with `list.sort(comparator)`.\n\n`Collections.sort` is just a wrapper, so it is better to use an instance method directly.\n\nThis inspection only reports if the language level of the project or module is 8 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "Java8ListSort",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 8",
"index": 120,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AssertEqualsCalledOnArray",
"shortDescription": {
"text": "'assertEquals()' called on array"
},
"fullDescription": {
"text": "Reports JUnit 'assertEquals()' calls with arguments of an array type. Such methods compare the arrays' identities instead of the arrays' contents. Array contents should be checked with the 'assertArrayEquals()' method. Example: '@Test\n public void testSort() {\n int[] actual = {248, 496, 0, 56};\n Arrays.sort(actual);\n Assert.assertEquals(new int[] {0, 56, 248, 496}, actual);\n }' After the quick-fix is applied: '@Test\n public void testSort() {\n int[] actual = {248, 496, 0, 56};\n Arrays.sort(actual);\n Assert.assertArrayEquals(new int[] {0, 56, 248, 496}, actual);\n }'",
"markdown": "Reports JUnit `assertEquals()` calls with arguments of an array type. Such methods compare the arrays' identities instead of the arrays' contents. Array contents should be checked with the `assertArrayEquals()` method.\n\n**Example:**\n\n\n @Test\n public void testSort() {\n int[] actual = {248, 496, 0, 56};\n Arrays.sort(actual);\n Assert.assertEquals(new int[] {0, 56, 248, 496}, actual);\n }\n\nAfter the quick-fix is applied:\n\n\n @Test\n public void testSort() {\n int[] actual = {248, 496, 0, 56};\n Arrays.sort(actual);\n Assert.assertArrayEquals(new int[] {0, 56, 248, 496}, actual);\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AssertEqualsCalledOnArray",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Test frameworks",
"index": 121,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ComparatorCombinators",
"shortDescription": {
"text": "'Comparator' combinator can be used"
},
"fullDescription": {
"text": "Reports 'Comparator' instances defined as lambda expressions that could be expressed using 'Comparator.comparing()' calls. Chained comparisons which can be replaced by 'Comparator.thenComparing()' expression are also reported. Example: 'myList.sort((person1, person2) -> person1.getName().compareTo(person2.getName()));\n\n myList2.sort((person1, person2) -> {\n int res = person1.first().compareTo(person2.first());\n if(res == 0) res = person1.second().compareTo(person2.second());\n if(res == 0) res = person1.third() - person2.third();\n return res;\n });' After the quick-fixes are applied: 'myList.sort(Comparator.comparing(Person::getName));\n\n myList2.sort(Comparator.comparing(Person::first)\n .thenComparing(Person::second)\n .thenComparingInt(Person::third));'",
"markdown": "Reports `Comparator` instances defined as lambda expressions that could be expressed using `Comparator.comparing()` calls. Chained comparisons which can be replaced by `Comparator.thenComparing()` expression are also reported.\n\nExample:\n\n\n myList.sort((person1, person2) -> person1.getName().compareTo(person2.getName()));\n\n myList2.sort((person1, person2) -> {\n int res = person1.first().compareTo(person2.first());\n if(res == 0) res = person1.second().compareTo(person2.second());\n if(res == 0) res = person1.third() - person2.third();\n return res;\n });\n\nAfter the quick-fixes are applied:\n\n\n myList.sort(Comparator.comparing(Person::getName));\n\n myList2.sort(Comparator.comparing(Person::first)\n .thenComparing(Person::second)\n .thenComparingInt(Person::third));\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ComparatorCombinators",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 8",
"index": 120,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "EqualsReplaceableByObjectsCall",
"shortDescription": {
"text": "'equals()' expression replaceable by 'Objects.equals()' expression"
},
"fullDescription": {
"text": "Reports expressions that can be replaced with a call to 'java.util.Objects#equals'. Example: 'void f(Object a, Object b) {\n boolean result = a != null && a.equals(b);\n }' After the quick-fix is applied: 'void f(Object a, Object b) {\n boolean result = Objects.equals(a, b);\n }' Replacing expressions like 'a != null && a.equals(b)' with 'Objects.equals(a, b)' slightly changes the semantics. Use the Highlight expressions like 'a != null && a.equals(b)' option to enable or disable this behavior. This inspection only reports if the language level of the project or module is 7 or higher.",
"markdown": "Reports expressions that can be replaced with a call to `java.util.Objects#equals`.\n\n**Example:**\n\n\n void f(Object a, Object b) {\n boolean result = a != null && a.equals(b);\n }\n\nAfter the quick-fix is applied:\n\n\n void f(Object a, Object b) {\n boolean result = Objects.equals(a, b);\n }\n\n\nReplacing expressions like `a != null && a.equals(b)` with `Objects.equals(a, b)`\nslightly changes the semantics. Use the **Highlight expressions like 'a != null \\&\\& a.equals(b)'** option to enable or disable this behavior.\n\nThis inspection only reports if the language level of the project or module is 7 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "EqualsReplaceableByObjectsCall",
"ideaSeverity": "WEAK WARNING",
"qodanaSeverity": "Moderate"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 7",
"index": 158,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AbstractMethodCallInConstructor",
"shortDescription": {
"text": "Abstract method called during object construction"
},
"fullDescription": {
"text": "Reports calls to 'abstract' methods of the current class during object construction. A method is called during object construction if it is inside a: Constructor Non-static instance initializer Non-static field initializer 'clone()' method 'readObject()' method 'readObjectNoData()' method Such calls may result in subtle bugs, as object initialization may happen before the method call. Example: 'abstract class Parent {\n abstract void abstractMethod();\n }\n\n class Child extends Parent {\n Child() {\n abstractMethod();\n }\n }' This inspection shares the functionality with the following inspections: Overridable method called during object construction Overridden method called during object construction Only one inspection should be enabled at once to prevent warning duplication.",
"markdown": "Reports calls to `abstract` methods of the current class during object construction.\n\nA method is called during object construction if it is inside a:\n\n* Constructor\n* Non-static instance initializer\n* Non-static field initializer\n* `clone()` method\n* `readObject()` method\n* `readObjectNoData()` method\n\nSuch calls may result in subtle bugs, as object initialization may happen before the method call.\n\n**Example:**\n\n\n abstract class Parent {\n abstract void abstractMethod();\n }\n\n class Child extends Parent {\n Child() {\n abstractMethod();\n }\n }\n\nThis inspection shares the functionality with the following inspections:\n\n* Overridable method called during object construction\n* Overridden method called during object construction\n\nOnly one inspection should be enabled at once to prevent warning duplication."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AbstractMethodCallInConstructor",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Initialization",
"index": 33,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TailRecursion",
"shortDescription": {
"text": "Tail recursion"
},
"fullDescription": {
"text": "Reports tail recursion, that is, when a method calls itself as its last action before returning. Tail recursion can always be replaced by looping, which will be considerably faster. Some JVMs perform tail-call optimization, while others do not. Thus, tail-recursive solutions may have considerably different performance characteristics on different virtual machines. Example: 'int factorial(int val, int runningVal) {\n if (val == 1) {\n return runningVal;\n } else {\n return factorial(val - 1, runningVal * val);\n }\n }' After the quick-fix is applied: 'int factorial(int val, int runningVal) {\n while (true) {\n if (val == 1) {\n return runningVal;\n } else {\n runningVal = runningVal * val;\n val = val - 1;\n }\n }\n }'",
"markdown": "Reports tail recursion, that is, when a method calls itself as its last action before returning.\n\n\nTail recursion can always be replaced by looping, which will be considerably faster.\nSome JVMs perform tail-call optimization, while others do not. Thus, tail-recursive solutions may have considerably different\nperformance characteristics on different virtual machines.\n\nExample:\n\n\n int factorial(int val, int runningVal) {\n if (val == 1) {\n return runningVal;\n } else {\n return factorial(val - 1, runningVal * val);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n int factorial(int val, int runningVal) {\n while (true) {\n if (val == 1) {\n return runningVal;\n } else {\n runningVal = runningVal * val;\n val = val - 1;\n }\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "TailRecursion",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StringEqualsEmptyString",
"shortDescription": {
"text": "'String.equals()' can be replaced with 'String.isEmpty()'"
},
"fullDescription": {
"text": "Reports 'equals()' being called to compare a 'String' with an empty string. In this case, using '.isEmpty()' is better as it shows you exactly what you're checking. Example: 'void checkString(String s){\n if (\"\".equals(s)) throw new IllegalArgumentException();\n }' After the quick-fix is applied: 'void checkString(String s){\n if (s != null && s.isEmpty()) throw new IllegalArgumentException();\n }' '\"\".equals(str)' returns false when 'str' is null. For safety, this inspection's quick-fix inserts an explicit null-check when the 'equals()' argument is nullable. Use the option to make the inspection ignore such cases.",
"markdown": "Reports `equals()` being called to compare a `String` with an empty string. In this case, using `.isEmpty()` is better as it shows you exactly what you're checking.\n\n**Example:**\n\n\n void checkString(String s){\n if (\"\".equals(s)) throw new IllegalArgumentException();\n }\n\nAfter the quick-fix is applied:\n\n\n void checkString(String s){\n if (s != null && s.isEmpty()) throw new IllegalArgumentException();\n }\n\n\n`\"\".equals(str)` returns false when `str` is null. For safety, this inspection's quick-fix inserts an explicit\nnull-check when\nthe `equals()` argument is nullable. Use the option to make the inspection ignore such cases."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "StringEqualsEmptyString",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PreviewFeature",
"shortDescription": {
"text": "Preview Feature warning"
},
"fullDescription": {
"text": "Reports usages of Preview Feature APIs, i.e. of a module, package, class, interface, method, constructor, field, or enum constant in the 'java.*' or 'javax.*' namespace annotated with '@PreviewFeature'. A preview feature is a new feature of the Java language, Java Virtual Machine, or Java SE API that is fully specified, fully implemented, and is yet impermanent. The notion of a preview feature is defined in JEP 12. If some piece of code depends on a preview API, it may stop compiling in future JDK versions if the feature is changed or removed. The inspection only reports if the language level of the project or module is Preview. New in 2021.1",
"markdown": "Reports usages of Preview Feature APIs, i.e. of a module, package, class, interface, method, constructor, field, or enum constant in the `java.*` or `javax.*` namespace annotated with `@PreviewFeature`.\n\n\nA preview feature is a new feature of the Java language, Java Virtual Machine, or Java SE API that is fully specified, fully implemented,\nand is yet impermanent. The notion of a preview feature is defined in [JEP 12](https://openjdk.org/jeps/12).\n\n\nIf some piece of code depends on a preview API, it may stop compiling in future JDK versions if the feature is changed or removed.\n\nThe inspection only reports if the language level of the project or module is **Preview**.\n\nNew in 2021.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "preview",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Compiler issues",
"index": 159,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TooBroadThrows",
"shortDescription": {
"text": "Overly broad 'throws' clause"
},
"fullDescription": {
"text": "Reports 'throws' clauses with exceptions that are more generic than the exceptions that the method actually throws. Example: 'public void createFile() throws Exception { // warning: 'throws Exception' is too broad, masking exception 'IOException'\n File file = new File(\"pathToFile\");\n file.createNewFile();\n }' After the quick-fix is applied: 'public void createFile() throws IOException {\n File file = new File(\"pathToFile\");\n file.createNewFile();\n }' Configure the inspection: Use the Maximum number of hidden exceptions to warn field to ignore exceptions, that hide a larger number of other exceptions than specified. Use the Only warn on RuntimeException, Exception, Error or Throwable option to have this inspection warn only on the most generic exceptions. Use the Ignore exceptions declared on methods overriding a library method option to ignore overly broad 'throws' clauses in methods that override a library method. Use the Ignore exceptions which hide others but are themselves thrown option to ignore any exceptions that hide other exceptions but still may be thrown from the method body and thus are technically not overly broad.",
"markdown": "Reports `throws` clauses with exceptions that are more generic than the exceptions that the method actually throws.\n\n**Example:**\n\n\n public void createFile() throws Exception { // warning: 'throws Exception' is too broad, masking exception 'IOException'\n File file = new File(\"pathToFile\");\n file.createNewFile();\n }\n\nAfter the quick-fix is applied:\n\n\n public void createFile() throws IOException {\n File file = new File(\"pathToFile\");\n file.createNewFile();\n }\n\nConfigure the inspection:\n\n* Use the **Maximum number of hidden exceptions to warn** field to ignore exceptions, that hide a larger number of other exceptions than specified.\n* Use the **Only warn on RuntimeException, Exception, Error or Throwable** option to have this inspection warn only on the most generic exceptions.\n* Use the **Ignore exceptions declared on methods overriding a library method** option to ignore overly broad `throws` clauses in methods that override a library method.\n* Use the **Ignore exceptions which hide others but are themselves thrown** option to ignore any exceptions that hide other exceptions but still may be thrown from the method body and thus are technically not overly broad."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OverlyBroadThrowsClause",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ImplicitSubclassInspection",
"shortDescription": {
"text": "Final declaration can't be overridden at runtime"
},
"fullDescription": {
"text": "Reports cases when your code prevents a class from being subclassed by some framework (for example, Spring or Hibernate) at runtime. Typical examples of necessary but impossible subclassing: 'final' classes marked with framework-specific annotations (for example, Spring '@Configuration') 'final', 'static' or 'private' methods marked with framework-specific annotations (for example, Spring '@Transactional') methods marked with framework-specific annotations inside 'final' classes The list of reported cases depends on the frameworks used.",
"markdown": "Reports cases when your code prevents a class from being subclassed by some framework (for example, Spring or Hibernate) at runtime.\n\nTypical examples of necessary but impossible subclassing:\n\n* `final` classes marked with framework-specific annotations (for example, Spring `@Configuration`)\n* `final`, `static` or `private` methods marked with framework-specific annotations (for example, Spring `@Transactional`)\n* methods marked with framework-specific annotations inside `final` classes\n\nThe list of reported cases depends on the frameworks used."
},
"defaultConfiguration": {
"enabled": true,
"level": "error",
"parameters": {
"suppressToolId": "ImplicitSubclassInspection",
"ideaSeverity": "ERROR",
"qodanaSeverity": "Critical"
}
},
"relationships": [
{
"target": {
"id": "Java/Inheritance issues",
"index": 147,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ObjectEqualsCanBeEquality",
"shortDescription": {
"text": "'equals()' call can be replaced with '=='"
},
"fullDescription": {
"text": "Reports calls to 'equals()' that can be replaced by '==' or '!=' expressions without a change in semantics. These calls can be replaced when they are used to compare 'final' classes that don't have their own 'equals()' implementation but use the default 'Object.equals()'. This replacement may result in better performance. There is a separate inspection for 'equals()' calls on 'enum' values: 'equals()' called on Enum value.",
"markdown": "Reports calls to `equals()` that can be replaced by `==` or `!=` expressions without a change in semantics.\n\nThese calls can be replaced when they are used to compare `final` classes that don't have their own `equals()` implementation but use the default `Object.equals()`.\nThis replacement may result in better performance.\n\nThere is a separate inspection for `equals()` calls on `enum` values: 'equals()' called on Enum value."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "ObjectEqualsCanBeEquality",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JDBCPrepareStatementWithNonConstantString",
"shortDescription": {
"text": "Call to 'Connection.prepare*()' with non-constant string"
},
"fullDescription": {
"text": "Reports calls to 'java.sql.Connection.prepareStatement()', 'java.sql.Connection.prepareCall()', or any of their variants which take a dynamically-constructed string as the statement to prepare. Constructed SQL statements are a common source of security breaches. By default, this inspection ignores compile-time constants. Example: 'String bar() { return \"bar\"; }\n\n Connection connection = DriverManager.getConnection(\"\", \"\", \"\");\n connection.(\"SELECT * FROM user WHERE name='\" + bar() + \"'\");' Use the inspection settings to consider any 'static' 'final' fields as constants. Be careful, because strings like the following will be ignored when the option is enabled: 'static final String SQL = \"SELECT * FROM user WHERE name='\" + getUserInput() + \"'\";'",
"markdown": "Reports calls to `java.sql.Connection.prepareStatement()`, `java.sql.Connection.prepareCall()`, or any of their variants which take a dynamically-constructed string as the statement to prepare.\n\n\nConstructed SQL statements are a common source of\nsecurity breaches. By default, this inspection ignores compile-time constants.\n\n**Example:**\n\n\n String bar() { return \"bar\"; }\n\n Connection connection = DriverManager.getConnection(\"\", \"\", \"\");\n connection.(\"SELECT * FROM user WHERE name='\" + bar() + \"'\");\n\nUse the inspection settings to consider any `static` `final` fields as constants. Be careful, because strings like the following will be ignored when the option is enabled:\n\n\n static final String SQL = \"SELECT * FROM user WHERE name='\" + getUserInput() + \"'\";\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "JDBCPrepareStatementWithNonConstantString",
"cweIds": [
89
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Security",
"index": 38,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SystemProperties",
"shortDescription": {
"text": "Access of system properties"
},
"fullDescription": {
"text": "Reports code that accesses system properties using one of the following methods: 'System.getProperties()', 'System.setProperty()', 'System.setProperties()', 'System.clearProperties()' 'Integer.getInteger()' 'Boolean.getBoolean()' While accessing the system properties is not a security risk in itself, it is often found in malicious code. Code that accesses system properties should be closely examined in any security audit.",
"markdown": "Reports code that accesses system properties using one of the following methods:\n\n* `System.getProperties()`, `System.setProperty()`, `System.setProperties()`, `System.clearProperties()`\n* `Integer.getInteger()`\n* `Boolean.getBoolean()`\n\n\nWhile accessing the system properties is not a security risk in itself, it is often found in malicious code.\nCode that accesses system properties should be closely examined in any security audit."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AccessOfSystemProperties",
"cweIds": [
250,
668
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Security",
"index": 38,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InvalidComparatorMethodReference",
"shortDescription": {
"text": "Invalid method reference used for 'Comparator'"
},
"fullDescription": {
"text": "Reports method references mapped to the 'Comparator' interface that don't fulfill its contract. Some method references, like 'Integer::max', can be mapped to the 'Comparator' interface. However, using them as 'Comparator' is meaningless and the result might be unpredictable. Example: 'ArrayList<Integer> ints = foo();\n ints.sort(Math::min);' After the quick-fix is applied: 'ArrayList<Integer> ints = foo();\n ints.sort(Comparator.reverseOrder());'",
"markdown": "Reports method references mapped to the `Comparator` interface that don't fulfill its contract.\n\n\nSome method references, like `Integer::max`, can be mapped to the `Comparator` interface.\nHowever, using them as `Comparator` is meaningless and the result might be unpredictable.\n\nExample:\n\n\n ArrayList<Integer> ints = foo();\n ints.sort(Math::min);\n\nAfter the quick-fix is applied:\n\n\n ArrayList<Integer> ints = foo();\n ints.sort(Comparator.reverseOrder());\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "InvalidComparatorMethodReference",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java9ModuleExportsPackageToItself",
"shortDescription": {
"text": "Module exports/opens package to itself"
},
"fullDescription": {
"text": "Reports packages that are exported to, or opened in the same Java 9 module in which they are defined. The quick-fix removes such directives from 'module-info.java'. Example: 'module com.mycomp {\n exports com.mycomp.main to com.mycomp;\n }' After the quick-fix is applied: 'module main {\n }' This inspection only reports if the language level of the project or module is 9 or higher.",
"markdown": "Reports packages that are exported to, or opened in the same Java 9 module in which they are defined. The quick-fix removes such directives from `module-info.java`.\n\nExample:\n\n\n module com.mycomp {\n exports com.mycomp.main to com.mycomp;\n }\n\nAfter the quick-fix is applied:\n\n\n module main {\n }\n\nThis inspection only reports if the language level of the project or module is 9 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "Java9ModuleExportsPackageToItself",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Visibility",
"index": 99,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ToArrayCallWithZeroLengthArrayArgument",
"shortDescription": {
"text": "'Collection.toArray()' call style"
},
"fullDescription": {
"text": "Reports 'Collection.toArray()' calls that are not in the preferred style, and suggests applying the preferred style. There are two styles to convert a collection to an array: A pre-sized array, for example, 'c.toArray(new String[c.size()])' An empty array, for example, 'c.toArray(new String[0])' In older Java versions, using a pre-sized array was recommended, as the reflection call necessary to create an array of proper size was quite slow. However, since late updates of OpenJDK 6, this call was intrinsified, making the performance of the empty array version the same, and sometimes even better, compared to the pre-sized version. Also, passing a pre-sized array is dangerous for a concurrent or synchronized collection as a data race is possible between the 'size' and 'toArray' calls. This may result in extra 'null's at the end of the array if the collection was concurrently shrunk during the operation. Use the inspection options to select the preferred style.",
"markdown": "Reports `Collection.toArray()` calls that are not in the preferred style, and suggests applying the preferred style.\n\nThere are two styles to convert a collection to an array:\n\n* A pre-sized array, for example, `c.toArray(new String[c.size()])`\n* An empty array, for example, `c.toArray(new String[0])`\n\nIn older Java versions, using a pre-sized array was recommended, as the reflection\ncall necessary to create an array of proper size was quite slow.\n\nHowever, since late updates of OpenJDK 6, this call was intrinsified, making\nthe performance of the empty array version the same, and sometimes even better, compared\nto the pre-sized version. Also, passing a pre-sized array is dangerous for a concurrent or\nsynchronized collection as a data race is possible between the `size` and `toArray`\ncalls. This may result in extra `null`s at the end of the array if the collection was concurrently\nshrunk during the operation.\n\nUse the inspection options to select the preferred style."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ToArrayCallWithZeroLengthArrayArgument",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LoggerInitializedWithForeignClass",
"shortDescription": {
"text": "Logger initialized with foreign class"
},
"fullDescription": {
"text": "Reports 'Logger' instances that are initialized with a 'class' literal from a different class than the 'Logger' is contained in. This can easily happen when copy-pasting some code from another class and may result in logging events under an unexpected category and cause filters to be applied incorrectly. A quick-fix is provided to replace the foreign class literal with one from the surrounding class. Example: 'public class Paramount {\n protected static final Logger LOG = Logger.getLogger(Critical.class);\n\n // ... other fields and methods\n }' After the quick-fix is applied: 'public class Paramount {\n protected static final Logger LOG = Logger.getLogger(Paramount.class);\n\n // ... other fields and methods\n }' Configure the inspection: Use the table to specify the logger factory classes and logger factory methods recognized by this inspection. Use the Ignore loggers initialized with a superclass option to ignore loggers that are initialized with a superclass of the class containing the logger. Use the Ignore loggers in non-public classes to only warn on loggers in 'public' classes.",
"markdown": "Reports `Logger` instances that are initialized with a `class` literal from a different class than the `Logger` is contained in. This can easily happen when copy-pasting some code from another class and may result in logging events under an unexpected category and cause filters to be applied incorrectly.\n\nA quick-fix is provided to replace the foreign class literal with one from the surrounding class.\n\n**Example:**\n\n\n public class Paramount {\n protected static final Logger LOG = Logger.getLogger(Critical.class);\n\n // ... other fields and methods\n }\n\nAfter the quick-fix is applied:\n\n\n public class Paramount {\n protected static final Logger LOG = Logger.getLogger(Paramount.class);\n\n // ... other fields and methods\n }\n\n\nConfigure the inspection:\n\n* Use the table to specify the logger factory classes and logger factory methods recognized by this inspection.\n* Use the **Ignore loggers initialized with a superclass** option to ignore loggers that are initialized with a superclass of the class containing the logger.\n* Use the **Ignore loggers in non-public classes** to only warn on loggers in `public` classes."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "LoggerInitializedWithForeignClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Logging",
"index": 77,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MarkerInterface",
"shortDescription": {
"text": "Marker interface"
},
"fullDescription": {
"text": "Reports marker interfaces without any methods or fields. Such interfaces may be confusing and typically indicate a design failure. The inspection ignores interfaces that extend two or more interfaces and interfaces that specify the generic type of their superinterface.",
"markdown": "Reports marker interfaces without any methods or fields.\n\nSuch interfaces may be confusing and typically indicate a design failure.\n\nThe inspection ignores interfaces that extend two or more interfaces and interfaces\nthat specify the generic type of their superinterface."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "MarkerInterface",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SortedCollectionWithNonComparableKeys",
"shortDescription": {
"text": "Sorted collection with non-comparable elements"
},
"fullDescription": {
"text": "Reports construction of sorted collections, for example 'TreeSet', that rely on natural ordering, whose element type doesn't implement the 'Comparable' interface. It's unlikely that such a collection will work properly. A false positive is possible if the collection element type is a non-comparable super-type, but the collection is intended to only hold comparable sub-types. Even if this is the case, it's better to narrow the collection element type or declare the super-type as 'Comparable' because the mentioned approach is error-prone. The inspection also reports cases when the collection element is a type parameter which is not declared as 'extends Comparable'. You can suppress the warnings on type parameters using the provided option (for example, to keep the API compatibility). New in 2018.3",
"markdown": "Reports construction of sorted collections, for example `TreeSet`, that rely on natural ordering, whose element type doesn't implement the `Comparable` interface.\n\nIt's unlikely that such a collection will work properly.\n\n\nA false positive is possible if the collection element type is a non-comparable super-type,\nbut the collection is intended to only hold comparable sub-types. Even if this is the case,\nit's better to narrow the collection element type or declare the super-type as `Comparable` because the mentioned approach is error-prone.\n\n\nThe inspection also reports cases when the collection element is a type parameter which is not declared as `extends Comparable`.\nYou can suppress the warnings on type parameters using the provided option (for example, to keep the API compatibility).\n\n\nNew in 2018.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SortedCollectionWithNonComparableKeys",
"cweIds": [
697
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CommentedOutCode",
"shortDescription": {
"text": "Commented out code"
},
"fullDescription": {
"text": "Reports comments that contain Java code. Usually, code that is commented out gets outdated very quickly and becomes misleading. As most projects use some kind of version control system, it is better to delete commented out code completely and use the VCS history instead. New in 2020.3",
"markdown": "Reports comments that contain Java code.\n\nUsually, code that is commented out gets outdated very quickly and becomes misleading.\nAs most projects use some kind of version control system,\nit is better to delete commented out code completely and use the VCS history instead.\n\nNew in 2020.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "CommentedOutCode",
"ideaSeverity": "WEAK WARNING",
"qodanaSeverity": "Moderate"
}
},
"relationships": [
{
"target": {
"id": "Java/Code maturity",
"index": 56,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassWithoutLogger",
"shortDescription": {
"text": "Class without logger"
},
"fullDescription": {
"text": "Reports classes which do not have a declared logger. Ensuring that every class has a dedicated logger is an important step in providing a unified logging implementation for an application. Interfaces, enumerations, annotations, inner classes, and abstract classes are not reported by this inspection. For example: 'public class NoLoggerDeclared {\n\n int calculateNthDigitOfPi(int n) {\n // todo\n return 1;\n }\n }' Use the table in the Options section to specify logger class names. Classes which do not declare a field with the type of one of the specified classes will be reported by this inspection.",
"markdown": "Reports classes which do not have a declared logger.\n\nEnsuring that every class has a dedicated logger is an important step in providing a unified logging\nimplementation for an application. Interfaces, enumerations, annotations, inner classes, and abstract classes are not reported by this inspection.\n\nFor example:\n\n\n public class NoLoggerDeclared {\n\n int calculateNthDigitOfPi(int n) {\n // todo\n return 1;\n }\n }\n\n\nUse the table in the **Options** section to specify logger class names.\nClasses which do not declare a field with the type of one of the specified classes will be reported by this inspection."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassWithoutLogger",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Logging",
"index": 77,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ReturnOfInnerClass",
"shortDescription": {
"text": "Return of instance of anonymous, local or inner class"
},
"fullDescription": {
"text": "Reports 'return' statements that return an instance of an anonymous, local, or inner class. Such instances keep an implicit reference to the outer instance, which can prevent the outer instance from being garbage-collected. Any caller of a method returning such an instance might cause a memory leak by holding on to the instance returned. Configure the inspection: Use the Ignore returns from non-public methods option to ignore returns from 'protected' or package-private methods. Returns from 'private' methods are always ignored.",
"markdown": "Reports `return` statements that return an instance of an anonymous, local, or inner class. Such instances keep an implicit reference to the outer instance, which can prevent the outer instance from being garbage-collected. Any caller of a method returning such an instance might cause a memory leak by holding on to the instance returned.\n\n\nConfigure the inspection:\n\n* Use the **Ignore returns from non-public methods** option to ignore returns from `protected` or package-private methods. Returns from `private` methods are always ignored."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ReturnOfInnerClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Memory",
"index": 163,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AnonymousClassComplexity",
"shortDescription": {
"text": "Overly complex anonymous class"
},
"fullDescription": {
"text": "Reports anonymous inner classes whose total complexity exceeds the specified maximum. The total complexity of a class is the sum of cyclomatic complexities of all the methods and initializers the class declares. Inherited methods and initializers are not counted toward the total complexity. Anonymous classes should have very low complexity otherwise they are hard to understand and should be promoted to become named inner classes. Use the Cyclomatic complexity limit field to specify the maximum allowed complexity for a class.",
"markdown": "Reports anonymous inner classes whose total complexity exceeds the specified maximum.\n\nThe total complexity of a class is the sum of cyclomatic complexities of all the methods\nand initializers the class declares. Inherited methods and initializers are not counted\ntoward the total complexity.\n\nAnonymous classes should have very low complexity otherwise they are hard to understand and should be promoted to become named inner classes.\n\nUse the **Cyclomatic complexity limit** field to specify the maximum allowed complexity for a class."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OverlyComplexAnonymousInnerClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class metrics",
"index": 123,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "WaitWithoutCorrespondingNotify",
"shortDescription": {
"text": "'wait()' without corresponding 'notify()'"
},
"fullDescription": {
"text": "Reports calls to 'Object.wait()', for which no call to the corresponding 'Object.notify()' or 'Object.notifyAll()' can be found. This inspection only reports calls with qualifiers referencing fields of the current class. Example: 'public class Foo {\n public Object foo = new Object();\n\n void bar() throws InterruptedException {\n this.foo.wait();\n }\n }'",
"markdown": "Reports calls to `Object.wait()`, for which no call to the corresponding `Object.notify()` or `Object.notifyAll()` can be found.\n\nThis inspection only reports calls with qualifiers referencing fields of the current class.\n\n**Example:**\n\n\n public class Foo {\n public Object foo = new Object();\n\n void bar() throws InterruptedException {\n this.foo.wait();\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "WaitWithoutCorrespondingNotify",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UseOfAWTPeerClass",
"shortDescription": {
"text": "Use of AWT peer class"
},
"fullDescription": {
"text": "Reports uses of AWT peer classes. Such classes represent native windowing system widgets, and will be non-portable between different windowing systems. Example: 'import java.awt.peer.ButtonPeer;\n\n abstract class Sample implements ButtonPeer {\n public void foo() {\n Sample sample;\n }\n }'",
"markdown": "Reports uses of AWT peer classes. Such classes represent native windowing system widgets, and will be non-portable between different windowing systems.\n\n**Example:**\n\n\n import java.awt.peer.ButtonPeer;\n\n abstract class Sample implements ButtonPeer {\n public void foo() {\n Sample sample;\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UseOfAWTPeerClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Portability",
"index": 95,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RedundantExplicitVariableType",
"shortDescription": {
"text": "Local variable type can be omitted"
},
"fullDescription": {
"text": "Reports redundant local variable types. These types can be inferred from the context and thus replaced with 'var'. Example: 'void test(InputStream s) {\n try (InputStream in = s) {}\n }' After the fix is applied: 'void test(InputStream s) {\n try (var in = s) {}\n }'",
"markdown": "Reports redundant local variable types.\n\nThese types can be inferred from the context and thus replaced with `var`.\n\n**Example:**\n\n\n void test(InputStream s) {\n try (InputStream in = s) {}\n }\n\nAfter the fix is applied:\n\n\n void test(InputStream s) {\n try (var in = s) {}\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "RedundantExplicitVariableType",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 10",
"index": 157,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SerializableWithUnconstructableAncestor",
"shortDescription": {
"text": "Serializable class with unconstructable ancestor"
},
"fullDescription": {
"text": "Reports 'Serializable' classes whose closest non-serializable ancestor doesn't have a no-argument constructor. Such classes cannot be deserialized and will fail with an 'InvalidClassException'. Example: 'class Ancestor {\n private String name;\n Ancestor(String name) {\n this.name = name;\n }\n }\n\n // warning on this class because the superclass is not\n // serializable, and its constructor takes arguments\n class Descendant extends Ancestor implements Serializable {\n Descendant() {\n super(\"Bob\");\n }\n }'",
"markdown": "Reports `Serializable` classes whose closest non-serializable ancestor doesn't have a no-argument constructor. Such classes cannot be deserialized and will fail with an `InvalidClassException`.\n\n**Example:**\n\n\n class Ancestor {\n private String name;\n Ancestor(String name) {\n this.name = name;\n }\n }\n\n // warning on this class because the superclass is not\n // serializable, and its constructor takes arguments\n class Descendant extends Ancestor implements Serializable {\n Descendant() {\n super(\"Bob\");\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SerializableClassWithUnconstructableAncestor",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Serialization issues",
"index": 20,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ExcessiveLambdaUsage",
"shortDescription": {
"text": "Excessive lambda usage"
},
"fullDescription": {
"text": "Reports if a trivial lambda expression is used in cases in which there's an alternative method that behaves in the same way, but accepts a concrete value instead of a lambda. This inspection helps simplify the code. Example: 'Optional.orElseGet(() -> null)' After the quick-fix is applied: 'Optional.orElse(null)' New in 2017.1",
"markdown": "Reports if a trivial lambda expression is used in cases in which there's an alternative method that behaves in the same way, but accepts a concrete value instead of a lambda.\n\nThis inspection helps simplify the code.\n\nExample:\n\n\n Optional.orElseGet(() -> null)\n\nAfter the quick-fix is applied:\n\n\n Optional.orElse(null)\n\nNew in 2017.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ExcessiveLambdaUsage",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ParameterHidingMemberVariable",
"shortDescription": {
"text": "Parameter hides field"
},
"fullDescription": {
"text": "Reports method parameters named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the parameter when using the identically named field is intended. A quick-fix is suggested to rename the parameter. Example: 'class Main {\n private String value;\n\n public Main(String value) {\n value = value.toUpperCase();\n }\n }' You can configure the following options for this inspection: Ignore for property setters - ignore parameters of simple setters. Ignore superclass fields not visible from subclass - ignore 'private' fields in a superclass, which are not visible from the method. Ignore for constructors - ignore parameters of constructors. Ignore for abstract methods - ignore parameters of abstract methods. Ignore for static method parameters hiding instance fields - ignore parameters of 'static' methods hiding an instance field and to ignore parameters of instance methods in static inner classes hiding an instance field of an outer class. While not strictly hiding, such parameters can still be confusing.",
"markdown": "Reports method parameters named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the parameter when using the identically named field is intended.\n\nA quick-fix is suggested to rename the parameter.\n\n**Example:**\n\n\n class Main {\n private String value;\n\n public Main(String value) {\n value = value.toUpperCase();\n }\n }\n \n\nYou can configure the following options for this inspection:\n\n1. **Ignore for property setters** - ignore parameters of simple setters.\n2. **Ignore superclass fields not visible from subclass** - ignore `private` fields in a superclass, which are not visible from the method.\n3. **Ignore for constructors** - ignore parameters of constructors.\n4. **Ignore for abstract methods** - ignore parameters of abstract methods.\n5. **Ignore for static method parameters hiding instance fields** - ignore parameters of `static` methods hiding an instance field and to ignore parameters of instance methods in static inner classes hiding an instance field of an outer class. While not strictly hiding, such parameters can still be confusing."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ParameterHidesMemberVariable",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Visibility",
"index": 99,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LambdaBodyCanBeCodeBlock",
"shortDescription": {
"text": "Lambda body can be code block"
},
"fullDescription": {
"text": "Reports lambdas whose body is an expression and suggests converting expression bodies to code blocks. Example: 'n -> n + 1' After the quick-fix is applied: 'n -> {\n return n + 1;\n}'",
"markdown": "Reports lambdas whose body is an expression and suggests converting expression bodies to code blocks.\n\nExample:\n\n\n n -> n + 1\n\nAfter the quick-fix is applied:\n\n n -> {\n return n + 1;\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "LambdaBodyCanBeCodeBlock",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CustomSecurityManager",
"shortDescription": {
"text": "Custom 'SecurityManager'"
},
"fullDescription": {
"text": "Reports user-defined subclasses of 'java.lang.SecurityManager'. While not necessarily representing a security hole, such classes should be thoroughly and professionally inspected for possible security issues. Example: 'class CustomSecurityManager extends SecurityManager {\n }'",
"markdown": "Reports user-defined subclasses of `java.lang.SecurityManager`.\n\n\nWhile not necessarily representing a security hole, such classes should be thoroughly\nand professionally inspected for possible security issues.\n\n**Example:**\n\n\n class CustomSecurityManager extends SecurityManager {\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CustomSecurityManager",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Security",
"index": 38,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TimeToString",
"shortDescription": {
"text": "Call to 'Time.toString()'"
},
"fullDescription": {
"text": "Reports 'toString()' calls on 'java.sql.Time' objects. Such calls are usually incorrect in an internationalized environment.",
"markdown": "Reports `toString()` calls on `java.sql.Time` objects. Such calls are usually incorrect in an internationalized environment."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CallToTimeToString",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Internationalization",
"index": 6,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ObjectEquality",
"shortDescription": {
"text": "Object comparison using '==', instead of 'equals()'"
},
"fullDescription": {
"text": "Reports code that uses '==' or '!=' rather than 'equals()' to test for object equality. Comparing objects using '==' or '!=' is often a bug, because it compares objects by identity instead of equality. Comparisons to 'null' are not reported. Array, 'String' and 'Number' comparisons are reported by separate inspections. Example: 'if (list1 == list2) {\n return;\n }' After the quick-fix is applied: 'if (Objects.equals(list1, list2)) {\n return;\n }' Use the inspection settings to configure exceptions for this inspection.",
"markdown": "Reports code that uses `==` or `!=` rather than `equals()` to test for object equality.\n\n\nComparing objects using `==` or `!=` is often a bug,\nbecause it compares objects by identity instead of equality.\nComparisons to `null` are not reported.\n\n\nArray, `String` and `Number` comparisons are reported by separate inspections.\n\n**Example:**\n\n if (list1 == list2) {\n return;\n }\n\nAfter the quick-fix is applied:\n\n if (Objects.equals(list1, list2)) {\n return;\n }\n\nUse the inspection settings to configure exceptions for this inspection."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "ObjectEquality",
"cweIds": [
480
],
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PatternVariablesCanBeReplacedWithCast",
"shortDescription": {
"text": "Using 'instanceof' with patterns"
},
"fullDescription": {
"text": "Reports 'instanceof' with patterns and suggests converting them to ordinary 'instanceof' with casts. This inspection makes it possible to move 'instanceof' with patterns to a codebase using an earlier Java version by applying the quick-fix. Note that the result can be not completely equivalent to the original 'instanceof' with patterns when a complex expression before 'instanceof' is used. In this case this expression will be reevaluated. Example: 'if (object instanceof String txt && txt.length() == 1) {\n System.out.println(txt);\n } else {\n return;\n }\n System.out.println(txt);' After the quick-fix is applied: 'if (object instanceof String && ((String) object).length() ==1) {\n String txt = (String) object;\n System.out.println(txt);\n } else {\n return;\n }\n String txt = (String) object;\n System.out.println(txt);' New in 2023.1",
"markdown": "Reports `instanceof` with patterns and suggests converting them to ordinary `instanceof` with casts.\n\nThis inspection makes it possible to move `instanceof` with patterns to a codebase using an earlier Java version\nby applying the quick-fix.\n\n\nNote that the result can be not completely equivalent to the original `instanceof` with patterns when\na complex expression before `instanceof` is used. In this case this expression will be reevaluated.\n\nExample:\n\n\n if (object instanceof String txt && txt.length() == 1) {\n System.out.println(txt);\n } else {\n return;\n }\n System.out.println(txt);\n\nAfter the quick-fix is applied:\n\n\n if (object instanceof String && ((String) object).length() ==1) {\n String txt = (String) object;\n System.out.println(txt);\n } else {\n return;\n }\n String txt = (String) object;\n System.out.println(txt);\n\nNew in 2023.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "PatternVariablesCanBeReplacedWithCast",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ManualArrayToCollectionCopy",
"shortDescription": {
"text": "Manual array to collection copy"
},
"fullDescription": {
"text": "Reports code that uses a loop to copy the contents of an array into a collection. A shorter and potentially faster (depending on the collection implementation) way to do this is using 'Collection.addAll(Arrays.asList())' or 'Collections.addAll()'. Only loops without additional statements inside are reported. Example: 'void addAll(List<String> list, String[] arr) {\n for (int i = 0; i < arr.length; i++) {\n String s = arr[i];\n list.add(s);\n }\n }' After the quick-fix is applied: 'void addAll(List<String> list, String[] arr) {\n Collections.addAll(list, arr);\n }'",
"markdown": "Reports code that uses a loop to copy the contents of an array into a collection.\n\n\nA shorter and potentially faster (depending on the collection implementation) way to do this is using `Collection.addAll(Arrays.asList())` or `Collections.addAll()`.\n\n\nOnly loops without additional statements inside are reported.\n\n**Example:**\n\n\n void addAll(List<String> list, String[] arr) {\n for (int i = 0; i < arr.length; i++) {\n String s = arr[i];\n list.add(s);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void addAll(List<String> list, String[] arr) {\n Collections.addAll(list, arr);\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ManualArrayToCollectionCopy",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SwitchLabeledRuleCanBeCodeBlock",
"shortDescription": {
"text": "Labeled switch rule can have code block"
},
"fullDescription": {
"text": "Reports rules of 'switch' expressions or enhanced 'switch' statements with an expression body. These can be converted to code blocks. Example: 'String message = switch (errorCode) {\n case 404 -> \"Not found!\";\n ...\n };' After the quick-fix is applied: 'String message = switch (errorCode) {\n case 404 -> {\n yield \"Not found!\";\n }\n ...\n };' The inspection only reports if the language level of the project or module is 14 or higher. New in 2019.1",
"markdown": "Reports rules of `switch` expressions or enhanced `switch` statements with an expression body. These can be converted to code blocks.\n\nExample:\n\n\n String message = switch (errorCode) {\n case 404 -> \"Not found!\";\n ...\n };\n\nAfter the quick-fix is applied:\n\n\n String message = switch (errorCode) {\n case 404 -> {\n yield \"Not found!\";\n }\n ...\n };\n\nThe inspection only reports if the language level of the project or module is 14 or higher.\n\nNew in 2019.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "SwitchLabeledRuleCanBeCodeBlock",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaReflectionMemberAccess",
"shortDescription": {
"text": "Reflective access to non-existent or not visible class member"
},
"fullDescription": {
"text": "Reports reflective access to fields and methods that don't exist or aren't visible. Example: 'Field stringHashField() throws NoSuchFieldException {\n return String.class.getField(\"hash\");\n }' After the quick-fix is applied: 'Field stringHashField() throws NoSuchFieldException {\n return String.class.getDeclaredField(\"hash\");\n }' With a 'final' class, it's clear if there is a field or method with the specified name in the class. With non-'final' classes, it's possible that a subclass has a field or method with that name, so there could be false positives. Use the inspection's settings to get rid of such false positives everywhere or with specific classes. New in 2017.2",
"markdown": "Reports reflective access to fields and methods that don't exist or aren't visible.\n\nExample:\n\n\n Field stringHashField() throws NoSuchFieldException {\n return String.class.getField(\"hash\");\n }\n\nAfter the quick-fix is applied:\n\n\n Field stringHashField() throws NoSuchFieldException {\n return String.class.getDeclaredField(\"hash\");\n }\n\n\nWith a `final` class, it's clear if there is a field or method with the specified name in the class.\n\n\nWith non-`final` classes, it's possible that a subclass has a field or method with that name, so there could be false positives.\nUse the inspection's settings to get rid of such false positives everywhere or with specific classes.\n\nNew in 2017.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "JavaReflectionMemberAccess",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Reflective access",
"index": 128,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ObviousNullCheck",
"shortDescription": {
"text": "Null-check method is called with obviously non-null argument"
},
"fullDescription": {
"text": "Reports if a null-checking method (for example, 'Objects.requireNonNull' or 'Assert.assertNotNull') is called on a value that is obviously non-null (for example, a newly created object). Such a check is redundant and may indicate a programming error. Example: 'final String greeting = Objects.requireNonNull(\"Hi!\");' After the quick-fix is applied: 'final String greeting = \"Hi!\";' New in 2017.2",
"markdown": "Reports if a null-checking method (for example, `Objects.requireNonNull` or `Assert.assertNotNull`) is called on a value that is obviously non-null (for example, a newly created object). Such a check is redundant and may indicate a programming error.\n\n**Example:**\n\n\n final String greeting = Objects.requireNonNull(\"Hi!\");\n\nAfter the quick-fix is applied:\n\n\n final String greeting = \"Hi!\";\n\nNew in 2017.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ObviousNullCheck",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SerialVersionUIDNotStaticFinal",
"shortDescription": {
"text": "'serialVersionUID' field not declared 'private static final long'"
},
"fullDescription": {
"text": "Reports 'Serializable' classes whose 'serialVersionUID' field is not declared 'private static final long'. Example: 'class SampleClass implements Serializable {\n private long serialVersionUID = 1; // field of a Serializable class is not declared 'private static final long'\n\n public SampleClass() {\n System.out.println(serialVersionUID);\n }\n }'",
"markdown": "Reports `Serializable` classes whose `serialVersionUID` field is not declared `private static final long`.\n\n**Example:**\n\n\n class SampleClass implements Serializable {\n private long serialVersionUID = 1; // field of a Serializable class is not declared 'private static final long'\n\n public SampleClass() {\n System.out.println(serialVersionUID);\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SerialVersionUIDWithWrongSignature",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Serialization issues",
"index": 20,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InnerClassOnInterface",
"shortDescription": {
"text": "Inner class of interface"
},
"fullDescription": {
"text": "Reports inner classes in 'interface' classes. Some coding standards discourage the use of such classes. The inspection doesn't report enum classes and annotation interfaces. Use the Ignore inner interfaces of interfaces option to ignore inner interfaces. For example: 'interface I {\n interface Inner {\n }\n }'",
"markdown": "Reports inner classes in `interface` classes.\n\nSome coding standards\ndiscourage the use of such classes. The inspection doesn't report enum classes and annotation interfaces.\n\n\nUse the **Ignore inner interfaces of interfaces** option to ignore inner interfaces. For example:\n\n\n interface I {\n interface Inner {\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "InnerClassOfInterface",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PublicFieldAccessedInSynchronizedContext",
"shortDescription": {
"text": "Non-private field accessed in 'synchronized' context"
},
"fullDescription": {
"text": "Reports non-'final', non-'private' fields that are accessed in a synchronized context. A non-'private' field cannot be guaranteed to always be accessed in a synchronized manner, and such \"partially synchronized\" access may result in unexpectedly inconsistent data structures. Example: 'class Bar {\n public String field1;\n }\n public Bar myBar;\n\n synchronized public void sample() {\n myBar.field1 = \"bar\";\n }'",
"markdown": "Reports non-`final`, non-`private` fields that are accessed in a synchronized context.\n\n\nA non-`private` field cannot be guaranteed to always be accessed in a synchronized manner, and such \"partially synchronized\"\naccess may result in unexpectedly inconsistent data structures.\n\n**Example:**\n\n\n class Bar {\n public String field1;\n }\n public Bar myBar;\n\n synchronized public void sample() {\n myBar.field1 = \"bar\";\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonPrivateFieldAccessedInSynchronizedContext",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnusedLabel",
"shortDescription": {
"text": "Unused label"
},
"fullDescription": {
"text": "Reports labels that are not targets of any 'break' or 'continue' statements. Example: 'label: for (int i = 0; i < 10; i++) {\n if (i == 3) {\n break;\n }\n }' After the quick-fix is applied, the label is removed: 'for (int i = 0; i < 10; i++) {\n if (i == 3) {\n break;\n }\n }'",
"markdown": "Reports labels that are not targets of any `break` or `continue` statements.\n\n**Example:**\n\n\n label: for (int i = 0; i < 10; i++) {\n if (i == 3) {\n break;\n }\n }\n\nAfter the quick-fix is applied, the label is removed:\n\n\n for (int i = 0; i < 10; i++) {\n if (i == 3) {\n break;\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnusedLabel",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Declaration redundancy",
"index": 12,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ForeachStatement",
"shortDescription": {
"text": "Enhanced 'for' statement"
},
"fullDescription": {
"text": "Reports enhanced 'for' statements. Example: 'for (int x: Arrays.asList(1, 2, 3)) {\n System.out.println(x);\n }' After the quick-fix is applied: 'for (Iterator<Integer> iterator = Arrays.asList(1, 2, 3).iterator(); iterator.hasNext(); ) {\n final int x = iterator.next();\n System.out.println(x);\n }' Enhanced 'for' statement appeared in Java 5. This inspection can help to downgrade for backward compatibility with earlier Java versions.",
"markdown": "Reports enhanced `for` statements.\n\nExample:\n\n\n for (int x: Arrays.asList(1, 2, 3)) {\n System.out.println(x);\n }\n\nAfter the quick-fix is applied:\n\n\n for (Iterator<Integer> iterator = Arrays.asList(1, 2, 3).iterator(); iterator.hasNext(); ) {\n final int x = iterator.next();\n System.out.println(x);\n }\n\n\n*Enhanced* `for` *statement* appeared in Java 5.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ForeachStatement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level issues",
"index": 143,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OptionalUsedAsFieldOrParameterType",
"shortDescription": {
"text": "'Optional' used as field or parameter type"
},
"fullDescription": {
"text": "Reports any cases in which 'java.util.Optional<T>', 'java.util.OptionalDouble', 'java.util.OptionalInt', 'java.util.OptionalLong', or 'com.google.common.base.Optional' are used as types for fields or parameters. 'Optional' was designed to provide a limited mechanism for library method return types in which a clear way to represent \"no result\" was needed. Using a field with the 'java.util.Optional' type is also problematic if the class needs to be 'Serializable', as 'java.util.Optional' is not serializable. Example: 'class MyClass {\n Optional<String> name; // Optional field\n\n // Optional parameter\n void setName(Optional<String> name) {\n this.name = name;\n }\n }'",
"markdown": "Reports any cases in which `java.util.Optional<T>`, `java.util.OptionalDouble`, `java.util.OptionalInt`, `java.util.OptionalLong`, or `com.google.common.base.Optional` are used as types for fields or parameters.\n\n`Optional` was designed to provide a limited mechanism for library method return types in which a clear way to represent \"no result\"\nwas needed.\n\nUsing a field with the `java.util.Optional` type is also problematic if the class needs to be\n`Serializable`, as `java.util.Optional` is not serializable.\n\nExample:\n\n\n class MyClass {\n Optional<String> name; // Optional field\n\n // Optional parameter\n void setName(Optional<String> name) {\n this.name = name;\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "OptionalUsedAsFieldOrParameterType",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Abstraction issues",
"index": 86,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ReplaceAllDot",
"shortDescription": {
"text": "Suspicious regex expression argument"
},
"fullDescription": {
"text": "Reports calls to 'String.replaceAll()' or 'String.split()' where the first argument is a single regex meta character argument. The regex meta characters are one of '.$|()[{^?*+\\'. They have a special meaning in regular expressions. For example, calling '\"ab.cd\".replaceAll(\".\", \"-\")' produces '\"-----\"', because the dot matches any character. Most likely the escaped variant '\"\\\\.\"' was intended instead. Using 'File.separator' as a regex is also reported. The 'File.separator' has a platform specific value. It equals to '/' on Linux and Mac but equals to '\\' on Windows, which is not a valid regular expression, so such code is not portable. Example: 's.replaceAll(\".\", \"-\");' After the quick-fix is applied: 's.replaceAll(\"\\\\.\", \"-\");'",
"markdown": "Reports calls to `String.replaceAll()` or `String.split()` where the first argument is a single regex meta character argument.\n\n\nThe regex meta characters are one of `.$|()[{^?*+\\`. They have a special meaning in regular expressions.\nFor example, calling `\"ab.cd\".replaceAll(\".\", \"-\")` produces `\"-----\"`, because the dot matches any character.\nMost likely the escaped variant `\"\\\\.\"` was intended instead.\n\n\nUsing `File.separator` as a regex is also reported. The `File.separator` has a platform specific value. It\nequals to `/` on Linux and Mac but equals to `\\` on Windows, which is not a valid regular expression, so\nsuch code is not portable.\n\n**Example:**\n\n\n s.replaceAll(\".\", \"-\");\n\nAfter the quick-fix is applied:\n\n\n s.replaceAll(\"\\\\.\", \"-\");\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SuspiciousRegexArgument",
"cweIds": [
20,
185,
628
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ForCanBeForeach",
"shortDescription": {
"text": "'for' loop can be replaced with enhanced for loop"
},
"fullDescription": {
"text": "Reports 'for' loops that iterate over collections or arrays, and can be automatically replaced with an enhanced 'for' loop (foreach iteration syntax). Example: 'for (Iterator<String> iterator = list.iterator(); iterator.hasNext(); ) {\n String item = iterator.next();\n System.out.println(item);\n }' After the quick-fix is applied: 'for (String item : list) {\n System.out.println(item);\n }' Use the Report indexed 'java.util.List' loops option to find loops involving 'list.get(index)' calls. Generally, these loops can be replaced with enhanced 'for' loops, unless they modify an underlying list in the process, for example, by calling 'list.remove(index)'. If the latter is the case, the enhanced 'for' loop may throw 'ConcurrentModificationException'. Also, in some cases, 'list.get(index)' loops may work a little bit faster. Use the Do not report iterations over untyped collections option to ignore collections without type parameters. This prevents the creation of enhanced 'for' loop variables of the 'java.lang.Object' type and the insertion of casts where the loop variable is used. This inspection only reports if the language level of the project or module is 5 or higher.",
"markdown": "Reports `for` loops that iterate over collections or arrays, and can be automatically replaced with an enhanced `for` loop (foreach iteration syntax).\n\n**Example:**\n\n\n for (Iterator<String> iterator = list.iterator(); iterator.hasNext(); ) {\n String item = iterator.next();\n System.out.println(item);\n }\n\nAfter the quick-fix is applied:\n\n\n for (String item : list) {\n System.out.println(item);\n }\n\n\nUse the **Report indexed 'java.util.List' loops** option to find loops involving `list.get(index)` calls.\nGenerally, these loops can be replaced with enhanced `for` loops,\nunless they modify an underlying list in the process, for example, by calling `list.remove(index)`.\nIf the latter is the case, the enhanced `for` loop may throw `ConcurrentModificationException`.\nAlso, in some cases, `list.get(index)` loops may work a little bit faster.\n\n\nUse the **Do not report iterations over untyped collections** option to ignore collections without type parameters.\nThis prevents the creation of enhanced `for` loop variables of the `java.lang.Object` type and the insertion of casts\nwhere the loop variable is used.\n\nThis inspection only reports if the language level of the project or module is 5 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ForLoopReplaceableByForEach",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 5",
"index": 119,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "PackageVisibleField",
"shortDescription": {
"text": "Package-visible field"
},
"fullDescription": {
"text": "Reports fields that are declared without any access modifier (also known as package-private). Constants (that is, fields marked 'static' and 'final') are not reported. Example: 'public class A {\n Object object; // warning\n final static int MODE = 0; // constant, no warning\n }'",
"markdown": "Reports fields that are declared without any access modifier (also known as package-private).\n\nConstants (that is, fields marked `static` and `final`) are not reported.\n\n**Example:**\n\n\n public class A {\n Object object; // warning\n final static int MODE = 0; // constant, no warning\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "PackageVisibleField",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Encapsulation",
"index": 125,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InstantiationOfUtilityClass",
"shortDescription": {
"text": "Instantiation of utility class"
},
"fullDescription": {
"text": "Reports instantiation of utility classes using the 'new' keyword. In utility classes, all fields and methods are 'static'. Instantiation of such classes is most likely unnecessary and indicates a mistake. Example: 'class MyUtils {\n public static double cube(double x) {\n return x * x * x;\n }\n }\n class Main {\n public static void main(String[] args) {\n // Instantiation of utility class\n MyUtils utils = new MyUtils();\n }\n }' To prevent utility classes from being instantiated, it's recommended to use a 'private' constructor.",
"markdown": "Reports instantiation of utility classes using the `new` keyword.\n\n\nIn utility classes, all fields and methods are `static`.\nInstantiation of such classes is most likely unnecessary and indicates a mistake.\n\n**Example:**\n\n\n class MyUtils {\n public static double cube(double x) {\n return x * x * x;\n }\n }\n class Main {\n public static void main(String[] args) {\n // Instantiation of utility class\n MyUtils utils = new MyUtils();\n }\n }\n\n\nTo prevent utility classes from being instantiated,\nit's recommended to use a `private` constructor."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "InstantiationOfUtilityClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "TrailingWhitespacesInTextBlock",
"shortDescription": {
"text": "Trailing whitespace in text block"
},
"fullDescription": {
"text": "Reports text blocks with trailing whitespace characters. Trailing whitespace is considered incidental and will be stripped away by the Java compiler. This inspection only reports if the language level of the project or module is 15 or higher. New in 2021.1",
"markdown": "Reports text blocks with trailing whitespace characters. Trailing whitespace is considered incidental and will be stripped away by the Java compiler.\n\nThis inspection only reports if the language level of the project or module is 15 or higher.\n\nNew in 2021.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "TrailingWhitespacesInTextBlock",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NewClassNamingConvention",
"shortDescription": {
"text": "Class naming convention"
},
"fullDescription": {
"text": "Reports classes whose names are too short, too long, or do not follow the specified regular expression pattern. Example: if the inspection is enabled for tests, and the specified length for the minimum class name is 8 (the default), the following test class produces a warning because the length of its name is 6, which is less than 8: 'public class MyTest{}'. A quick-fix that renames such classes is available only in the editor. Configure the inspection: Use the list in the Options section to specify which classes should be checked. Deselect the checkboxes for the classes for which you want to skip the check. For each class type, specify the minimum length, maximum length, and the regular expression expected for class names using the provided input fields. Specify 0 in the length fields to skip corresponding checks. Regular expressions should be specified in the standard 'java.util.regex' format.",
"markdown": "Reports classes whose names are too short, too long, or do not follow the specified regular expression pattern.\n\n**Example:** if the inspection is enabled for tests, and the specified length for the minimum class name is 8 (the default), the following test class\nproduces a warning because the length of its name is 6, which is less than 8: `public class MyTest{}`.\n\nA quick-fix that renames such classes is available only in the editor.\n\nConfigure the inspection:\n\n\nUse the list in the **Options** section to specify which classes should be checked. Deselect the checkboxes for the classes for which\nyou want to skip the check.\n\nFor each class type, specify the minimum length, maximum length, and the regular expression expected for class names using the\nprovided input fields. Specify **0** in the length fields to skip corresponding checks.\n\nRegular expressions should be specified in the standard `java.util.regex` format."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "NewClassNamingConvention",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Naming conventions/Class",
"index": 82,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UseCompareMethod",
"shortDescription": {
"text": "'compare()' method can be used to compare numbers"
},
"fullDescription": {
"text": "Reports expressions that can be replaced by a call to the 'Integer.compare()' method or a similar method from the 'Long', 'Short', 'Byte', 'Double' or 'Float' classes, instead of more verbose or less efficient constructs. If 'x' and 'y' are boxed integers, then 'x.compareTo(y)' is suggested, if they are primitives 'Integer.compare(x, y)' is suggested. Example: 'public int compare(int x, int y) {\n return x > y ? 1 : x < y ? -1 : 0;\n }' After the quick-fix is applied: 'public int compare(int x, int y) {\n return Integer.compare(x, y);\n }' Note that 'Double.compare' and 'Float.compare' slightly change the code semantics. In particular, they make '-0.0' and '0.0' distinguishable ('Double.compare(-0.0, 0.0)' yields -1). Also, they consistently process 'NaN' value. In most of the cases, this semantics change actually improves the code. Use the checkbox to disable this inspection for floating point numbers if semantics change is unacceptable in your case. New in 2017.2",
"markdown": "Reports expressions that can be replaced by a call to the `Integer.compare()` method or a similar method from the `Long`, `Short`, `Byte`, `Double` or `Float` classes, instead of more verbose or less efficient constructs.\n\nIf `x` and `y` are boxed integers, then `x.compareTo(y)` is suggested,\nif they are primitives `Integer.compare(x, y)` is suggested.\n\n**Example:**\n\n\n public int compare(int x, int y) {\n return x > y ? 1 : x < y ? -1 : 0;\n }\n\nAfter the quick-fix is applied:\n\n\n public int compare(int x, int y) {\n return Integer.compare(x, y);\n }\n\n\nNote that `Double.compare` and `Float.compare` slightly change the code semantics. In particular,\nthey make `-0.0` and `0.0` distinguishable (`Double.compare(-0.0, 0.0)` yields -1).\nAlso, they consistently process `NaN` value. In most of the cases, this semantics change actually improves the\ncode. Use the checkbox to disable this inspection for floating point numbers if semantics change is unacceptable\nin your case.\n\nNew in 2017.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UseCompareMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids",
"index": 70,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MoveFieldAssignmentToInitializer",
"shortDescription": {
"text": "Field assignment can be moved to initializer"
},
"fullDescription": {
"text": "Suggests replacing initialization of fields using assignment with initialization in the field declaration. Only reports if the field assignment is located in an instance or static initializer, and joining it with the field declaration is likely to be safe. In other cases, like assignment inside a constructor, the quick-fix is provided without highlighting, as the fix may change the semantics. Example: 'class MyClass {\n static final int intConstant;\n \n static {\n intConstant = 10;\n }\n }' The quick fix moves the assigned value to the field initializer removing the class initializer if possible: 'class MyClass {\n static final int intConstant = 10;\n }' Since 2017.2",
"markdown": "Suggests replacing initialization of fields using assignment with initialization in the field declaration.\n\nOnly reports if the field assignment is located in an instance or static initializer, and\njoining it with the field declaration is likely to be safe.\nIn other cases, like assignment inside a constructor, the quick-fix is provided without highlighting,\nas the fix may change the semantics.\n\nExample:\n\n\n class MyClass {\n static final int intConstant;\n \n static {\n intConstant = 10;\n }\n }\n\nThe quick fix moves the assigned value to the field initializer removing the class initializer if possible:\n\n\n class MyClass {\n static final int intConstant = 10;\n }\n\nSince 2017.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "MoveFieldAssignmentToInitializer",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StringConcatenationInFormatCall",
"shortDescription": {
"text": "String concatenation as argument to 'format()' call"
},
"fullDescription": {
"text": "Reports non-constant string concatenations used as a format string argument. While occasionally intended, this is usually a misuse of a formatting method and may even cause security issues if the variables used in the concatenated string contain special characters like '%'. Also, sometimes this could be the result of mistakenly concatenating a string format argument by typing a '+' when a ',' was meant. Example: 'static String formatGreeting(String userName) {\n return String.format(\"Hello, \" + userName);\n }' Here, the 'userName' will be interpreted as a part of format string, which may result in 'IllegalFormatException' (for example, if 'userName' is '\"%\"') or in using an enormous amount of memory (for example, if 'userName' is '\"%2000000000%\"'). The call should be probably replaced with 'String.format(\"Hello, %s\", userName);'. This inspection checks calls to formatting methods on 'java.util.Formatter', 'java.lang.String', 'java.io.PrintWriter', or 'java.io.PrintStream'.",
"markdown": "Reports non-constant string concatenations used as a format string argument.\n\n\nWhile occasionally intended, this is usually a misuse of a formatting method\nand may even cause security issues if the variables used in the concatenated string\ncontain special characters like `%`.\n\n\nAlso, sometimes this could be the result\nof mistakenly concatenating a string format argument by typing a `+` when a `,` was meant.\n\n**Example:**\n\n\n static String formatGreeting(String userName) {\n return String.format(\"Hello, \" + userName);\n }\n\n\nHere, the `userName` will be interpreted as a part of format string, which may result\nin `IllegalFormatException` (for example, if `userName` is `\"%\"`) or\nin using an enormous amount of memory (for example, if `userName` is `\"%2000000000%\"`).\nThe call should be probably replaced with `String.format(\"Hello, %s\", userName);`.\n\n\nThis inspection checks calls to formatting methods on\n`java.util.Formatter`,\n`java.lang.String`,\n`java.io.PrintWriter`,\nor `java.io.PrintStream`."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "StringConcatenationInFormatCall",
"cweIds": [
116,
134
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "WaitWhileHoldingTwoLocks",
"shortDescription": {
"text": "'wait()' while holding two locks"
},
"fullDescription": {
"text": "Reports calls to 'wait()' methods that may occur while the current thread is holding two locks. Since calling 'wait()' only releases one lock on its target, waiting with two locks held can easily lead to a deadlock. Example: 'synchronized (lockA) {\n synchronized (lockB) {\n lockB.wait(); //warning\n //thread A is stuck here holding lockA\n }\n }\n\n synchronized (lockA) { //thread B can't enter the block and release thread A\n lockB.notify();\n }'",
"markdown": "Reports calls to `wait()` methods that may occur while the current thread is holding two locks.\n\n\nSince calling `wait()` only releases one lock on its target,\nwaiting with two locks held can easily lead to a deadlock.\n\n**Example:**\n\n\n synchronized (lockA) {\n synchronized (lockB) {\n lockB.wait(); //warning\n //thread A is stuck here holding lockA\n }\n }\n\n synchronized (lockA) { //thread B can't enter the block and release thread A\n lockB.notify();\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "WaitWhileHoldingTwoLocks",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SerializableInnerClassWithNonSerializableOuterClass",
"shortDescription": {
"text": "Serializable non-'static' inner class with non-Serializable outer class"
},
"fullDescription": {
"text": "Reports non-static inner classes that implement 'Serializable' and are declared inside a class that doesn't implement 'Serializable'. Such classes are unlikely to serialize correctly due to implicit references to the outer class. Example: 'class A {\n class Main implements Serializable {\n }\n }' Use the following options to configure the inspection: List classes whose inheritors should not be reported by this inspection. This is meant for classes that inherit 'Serializable' from a superclass but are not intended for serialization. Whether to ignore 'Serializable' anonymous classes.",
"markdown": "Reports non-static inner classes that implement `Serializable` and are declared inside a class that doesn't implement `Serializable`.\n\n\nSuch classes are unlikely to serialize correctly due to implicit references to the outer class.\n\n**Example:**\n\n\n class A {\n class Main implements Serializable {\n }\n }\n\nUse the following options to configure the inspection:\n\n* List classes whose inheritors should not be reported by this inspection. This is meant for classes that inherit `Serializable` from a superclass but are not intended for serialization.\n* Whether to ignore `Serializable` anonymous classes."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SerializableInnerClassWithNonSerializableOuterClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Serialization issues",
"index": 20,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SuspiciousListRemoveInLoop",
"shortDescription": {
"text": "Suspicious 'List.remove()' in loop"
},
"fullDescription": {
"text": "Reports 'list.remove(index)' calls inside an ascending counted loop. This is suspicious as the list becomes shorter after the removal, and the next element gets skipped. A simple fix is to decrease the index variable after the removal, but probably removing via an iterator or using the 'removeIf()' method (Java 8 and later) is a more robust alternative. If you don't expect that 'remove()' will be called more than once in a loop, consider adding a 'break' after it. Example: 'public static void main(String[] args) {\n process(new ArrayList<>(\n Arrays.asList(\"1\", \"2\", \"|\", \"3\", \"4\")));\n }\n\n static void process(List<String> list) {\n for (int i = 0; i < list.size(); i++) {\n if (list.get(i).equals(\"|\")) {\n list.remove(i);\n continue;\n }\n System.out.println(list.get(i));\n }\n }' The code looks like '1 2 3 4' is going to be printed, but in reality, '3' will be skipped in the output. New in 2018.2",
"markdown": "Reports `list.remove(index)` calls inside an ascending counted loop.\n\n\nThis is suspicious as the list becomes\nshorter after the removal, and the next element gets skipped. A simple fix is to decrease the index variable\nafter the removal,\nbut probably removing via an iterator or using the `removeIf()` method (Java 8 and later) is a more robust alternative.\nIf you don't expect that `remove()` will be called more than once in a loop, consider adding a `break` after it.\n\n**Example:**\n\n public static void main(String[] args) {\n process(new ArrayList<>(\n Arrays.asList(\"1\", \"2\", \"|\", \"3\", \"4\")));\n }\n\n static void process(List<String> list) {\n for (int i = 0; i < list.size(); i++) {\n if (list.get(i).equals(\"|\")) {\n list.remove(i);\n continue;\n }\n System.out.println(list.get(i));\n }\n }\n\nThe code looks like `1 2 3 4` is going to be printed, but in reality, `3` will be skipped in the output.\n\nNew in 2018.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SuspiciousListRemoveInLoop",
"cweIds": [
129
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NegativeIntConstantInLongContext",
"shortDescription": {
"text": "Negative int hexadecimal constant in long context"
},
"fullDescription": {
"text": "Reports negative int hexadecimal constants in long context. Such constants are implicitly widened to long, which means their higher bits will become 1 rather than 0 (e.g., 0xFFFF_FFFF will become 0xFFFF_FFFF_FFFF_FFFFL). Unlikely this is intended, and even if it is, using an explicit long constant would be less confusing. Example: '// Warning: this is int constant -1 which is widened to long\n // becoming 0xFFFF_FFFF_FFFF_FFFFL.\n long mask = 0xFFFF_FFFF;' New in 2022.3",
"markdown": "Reports negative int hexadecimal constants in long context. Such constants are implicitly widened to long, which means their higher bits will become 1 rather than 0 (e.g., 0xFFFF_FFFF will become 0xFFFF_FFFF_FFFF_FFFFL). Unlikely this is intended, and even if it is, using an explicit long constant would be less confusing.\n\n**Example:**\n\n\n // Warning: this is int constant -1 which is widened to long\n // becoming 0xFFFF_FFFF_FFFF_FFFFL.\n long mask = 0xFFFF_FFFF;\n\nNew in 2022.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "NegativeIntConstantInLongContext",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "DefaultAnnotationParam",
"shortDescription": {
"text": "Default annotation parameter value"
},
"fullDescription": {
"text": "Reports annotation parameters that are assigned to their 'default' value. Example: '@interface Test {\n Class<?> expected() default Throwable.class;\n }\n\n @Test(expected = Throwable.class)\n void testSmth() {}' After the quick-fix is applied: '@Test()\n void testSmth() {}'",
"markdown": "Reports annotation parameters that are assigned to their `default` value.\n\nExample:\n\n\n @interface Test {\n Class<?> expected() default Throwable.class;\n }\n\n @Test(expected = Throwable.class)\n void testSmth() {}\n\nAfter the quick-fix is applied:\n\n\n @Test()\n void testSmth() {}\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "DefaultAnnotationParam",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Declaration redundancy",
"index": 12,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "WhileLoopSpinsOnField",
"shortDescription": {
"text": "'while' loop spins on field"
},
"fullDescription": {
"text": "Reports 'while' loops that spin on the value of a non-'volatile' field, waiting for it to be changed by another thread. In addition to being potentially extremely CPU intensive when little work is done inside the loop, such loops are likely to have different semantics from what was intended. The Java Memory Model allows such loops to never complete even if another thread changes the field's value. Additionally, since Java 9 it's recommended to call 'Thread.onSpinWait()' inside a spin loop on a 'volatile' field, which may significantly improve performance on some hardware. Example: 'class SpinsOnField {\n boolean ready = false;\n\n void run() {\n while (!ready) {\n }\n // do some work\n }\n\n void markAsReady() {\n ready = true;\n }\n }' After the quick-fix is applied: 'class SpinsOnField {\n volatile boolean ready = false;\n\n void run() {\n while (!ready) {\n Thread.onSpinWait();\n }\n // do some work\n }\n\n void markAsReady() {\n ready = true;\n }\n }' Use the inspection options to only report empty 'while' loops.",
"markdown": "Reports `while` loops that spin on the value of a non-`volatile` field, waiting for it to be changed by another thread.\n\n\nIn addition to being potentially extremely CPU intensive when little work is done inside the loop, such\nloops are likely to have different semantics from what was intended.\nThe Java Memory Model allows such loops to never complete even if another thread changes the field's value.\n\n\nAdditionally, since Java 9 it's recommended to call `Thread.onSpinWait()` inside a spin loop\non a `volatile` field, which may significantly improve performance on some hardware.\n\n**Example:**\n\n\n class SpinsOnField {\n boolean ready = false;\n\n void run() {\n while (!ready) {\n }\n // do some work\n }\n\n void markAsReady() {\n ready = true;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class SpinsOnField {\n volatile boolean ready = false;\n\n void run() {\n while (!ready) {\n Thread.onSpinWait();\n }\n // do some work\n }\n\n void markAsReady() {\n ready = true;\n }\n }\n\n\nUse the inspection options to only report empty `while` loops."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "WhileLoopSpinsOnField",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SynchronizeOnLock",
"shortDescription": {
"text": "Synchronization on a 'Lock' object"
},
"fullDescription": {
"text": "Reports 'synchronized' blocks that lock on an instance of 'java.util.concurrent.locks.Lock'. Such synchronization is almost certainly unintended, and appropriate versions of '.lock()' and '.unlock()' should be used instead. Example: 'final ReentrantLock lock = new ReentrantLock();\n\n public void foo() {\n synchronized (lock) {}\n }'",
"markdown": "Reports `synchronized` blocks that lock on an instance of `java.util.concurrent.locks.Lock`. Such synchronization is almost certainly unintended, and appropriate versions of `.lock()` and `.unlock()` should be used instead.\n\n**Example:**\n\n\n final ReentrantLock lock = new ReentrantLock();\n\n public void foo() {\n synchronized (lock) {}\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SynchroniziationOnLockObject",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "BadExceptionCaught",
"shortDescription": {
"text": "Prohibited 'Exception' caught"
},
"fullDescription": {
"text": "Reports 'catch' clauses that catch an inappropriate exception. Some exceptions, for example 'java.lang.NullPointerException' or 'java.lang.IllegalMonitorStateException', represent programming errors and therefore almost certainly should not be caught in production code. Example: 'try {\n return component.getMousePosition(true) != null;\n } catch (NullPointerException e) { // warning: Prohibited exception 'NullPointerException' caught\n return false;\n }' Use the Prohibited exceptions list to specify which exceptions should be reported.",
"markdown": "Reports `catch` clauses that catch an inappropriate exception.\n\nSome exceptions, for example\n`java.lang.NullPointerException` or\n`java.lang.IllegalMonitorStateException`, represent programming errors\nand therefore almost certainly should not be caught in production code.\n\n**Example:**\n\n\n try {\n return component.getMousePosition(true) != null;\n } catch (NullPointerException e) { // warning: Prohibited exception 'NullPointerException' caught\n return false;\n }\n\nUse the **Prohibited exceptions** list to specify which exceptions should be reported."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ProhibitedExceptionCaught",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InstanceofCatchParameter",
"shortDescription": {
"text": "'instanceof' on 'catch' parameter"
},
"fullDescription": {
"text": "Reports cases in which an 'instanceof' expression is used for testing the type of a parameter in a 'catch' block. Testing the type of 'catch' parameters is usually better done by having separate 'catch' blocks instead of using 'instanceof'. Example: 'void foo(Runnable runnable) {\n try {\n runnable.run();\n } catch (Throwable throwable) {\n if (throwable instanceof NoClassDefFoundError) { // warning: 'instanceof' on 'catch' parameter 'throwable'\n System.out.println(\"Class not found!\");\n }\n }\n }'",
"markdown": "Reports cases in which an `instanceof` expression is used for testing the type of a parameter in a `catch` block.\n\nTesting the type of `catch` parameters is usually better done by having separate\n`catch` blocks instead of using `instanceof`.\n\n**Example:**\n\n\n void foo(Runnable runnable) {\n try {\n runnable.run();\n } catch (Throwable throwable) {\n if (throwable instanceof NoClassDefFoundError) { // warning: 'instanceof' on 'catch' parameter 'throwable'\n System.out.println(\"Class not found!\");\n }\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "InstanceofCatchParameter",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RedundantScheduledForRemovalAnnotation",
"shortDescription": {
"text": "Redundant @ScheduledForRemoval annotation"
},
"fullDescription": {
"text": "Reports usages of '@ApiStatus.ScheduledForRemoval' annotation without 'inVersion' attribute in code which targets Java 9 or newer version. Such usages can be replaced by 'forRemoval' attribute in '@Deprecated' annotation to simplify code. New in 2022.1",
"markdown": "Reports usages of `@ApiStatus.ScheduledForRemoval` annotation without `inVersion` attribute in code which targets Java 9 or newer version.\n\n\nSuch usages can be replaced by `forRemoval` attribute in `@Deprecated` annotation to simplify code.\n\nNew in 2022.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "RedundantScheduledForRemovalAnnotation",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code maturity",
"index": 56,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OptionalGetWithoutIsPresent",
"shortDescription": {
"text": "Optional.get() is called without isPresent() check"
},
"fullDescription": {
"text": "Reports calls to 'get()' on an 'Optional' without checking that it has a value. Calling 'Optional.get()' on an empty 'Optional' instance will throw an exception. Example: 'void x(List<Integer> list) {\n final Optional<Integer> optional =\n list.stream().filter(x -> x > 10).findFirst();\n final Integer result = optional.get(); // problem here\n }'",
"markdown": "Reports calls to `get()` on an `Optional` without checking that it has a value.\n\nCalling `Optional.get()` on an empty `Optional` instance will throw an exception.\n\n**Example:**\n\n\n void x(List<Integer> list) {\n final Optional<Integer> optional =\n list.stream().filter(x -> x > 10).findFirst();\n final Integer result = optional.get(); // problem here\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "OptionalGetWithoutIsPresent",
"cweIds": [
252,
476
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OnDemandImport",
"shortDescription": {
"text": "'*' import"
},
"fullDescription": {
"text": "Reports any 'import' statements that cover entire packages ('* imports'). Some coding standards prohibit such 'import' statements. You can configure IntelliJ IDEA to detect and fix such statements with its Optimize Imports command. Go to Settings | Editor | Code Style | Java | Imports, make sure that the Use single class import option is enabled, and specify values in the Class count to use import with '*' and Names count to use static import with '*' fields. Thus this inspection is mostly useful for offline reporting on code bases that you don't intend to change.",
"markdown": "Reports any `import` statements that cover entire packages ('\\* imports').\n\nSome coding standards prohibit such `import` statements.\n\n\nYou can configure IntelliJ IDEA to detect and fix such statements with its **Optimize Imports**\ncommand. Go to [Settings \\| Editor \\| Code Style \\| Java \\| Imports](settings://preferences.sourceCode.Java?Use%20single%20class%20import),\nmake sure that the **Use single class import** option is enabled, and specify values in the\n**Class count to use import with '\\*'** and **Names count to use static import with '\\*'** fields.\nThus this inspection is mostly useful for offline reporting on code bases that you don't\nintend to change."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OnDemandImport",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Imports",
"index": 24,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "FallthruInSwitchStatement",
"shortDescription": {
"text": "Fallthrough in 'switch' statement"
},
"fullDescription": {
"text": "Reports 'fall-through' in a 'switch' statement. Fall-through occurs when a series of executable statements after a 'case' label is not guaranteed to transfer control before the next 'case' label. For example, this can happen if the branch is missing a 'break' statement. In that case, control falls through to the statements after that 'switch' label, even though the 'switch' expression is not equal to the value of the fallen-through label. While occasionally intended, this construction is confusing and is often the result of a typo. This inspection ignores any fall-through commented with a text matching the regex pattern '(?i)falls?\\s*thro?u'. There is a fix that adds a 'break' to the branch that can fall through to the next branch. Example: 'switch(x) {\n case (4):\n if (condition) {\n System.out.println(\"3\");\n // no break here\n } else {\n break;\n }\n case (6):\n System.out.println(\"4\");\n }' After the quick-fix is applied: 'switch(x) {\n case (4):\n if (condition) {\n System.out.println(\"3\");\n } else {\n break;\n }\n break;\n case (6):\n System.out.println(\"4\");\n }'",
"markdown": "Reports 'fall-through' in a `switch` statement.\n\nFall-through occurs when a series of executable statements after a `case` label is not guaranteed\nto transfer control before the next `case` label. For example, this can happen if the branch is missing a `break` statement.\nIn that case, control falls through to the statements after\nthat `switch` label, even though the `switch` expression is not equal to\nthe value of the fallen-through label. While occasionally intended, this construction is confusing and is often the result of a typo.\n\n\nThis inspection ignores any fall-through commented with a text matching the regex pattern `(?i)falls?\\s*thro?u`.\n\nThere is a fix that adds a `break` to the branch that can fall through to the next branch.\n\nExample:\n\n\n switch(x) {\n case (4):\n if (condition) {\n System.out.println(\"3\");\n // no break here\n } else {\n break;\n }\n case (6):\n System.out.println(\"4\");\n }\n\nAfter the quick-fix is applied:\n\n\n switch(x) {\n case (4):\n if (condition) {\n System.out.println(\"3\");\n } else {\n break;\n }\n break;\n case (6):\n System.out.println(\"4\");\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "fallthrough",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OptionalIsPresent",
"shortDescription": {
"text": "Non functional style 'Optional.isPresent()' usage"
},
"fullDescription": {
"text": "Reports 'Optional' expressions used as 'if' or conditional expression conditions, that can be rewritten in a functional style. The result is often shorter and easier to read. Example: 'if (str.isPresent()) str.get().trim();' After the quick-fix is applied: 'str.ifPresent(String::trim);' This inspection only reports if the language level of the project or module is 8 or higher.",
"markdown": "Reports `Optional` expressions used as `if` or conditional expression conditions, that can be rewritten in a functional style. The result is often shorter and easier to read.\n\nExample:\n\n\n if (str.isPresent()) str.get().trim();\n\nAfter the quick-fix is applied:\n\n\n str.ifPresent(String::trim);\n\nThis inspection only reports if the language level of the project or module is 8 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "OptionalIsPresent",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RedundantOperationOnEmptyContainer",
"shortDescription": {
"text": "Redundant operation on empty container"
},
"fullDescription": {
"text": "Reports redundant operations on empty collections, maps or arrays. Iterating, removing elements, sorting, and some other operations on empty collections have no effect and can be removed. Also, they may be a signal of a bug. Example: 'if (numbers.isEmpty()){\n //error due to the missed negation\n int max = numbers.stream().max(Comparator.naturalOrder()).get();\n ...\n }' New in 2019.1",
"markdown": "Reports redundant operations on empty collections, maps or arrays.\n\n\nIterating, removing elements, sorting,\nand some other operations on empty collections have no effect and can be removed. Also, they may be a signal of a bug.\n\n**Example:**\n\n\n if (numbers.isEmpty()){\n //error due to the missed negation\n int max = numbers.stream().max(Comparator.naturalOrder()).get();\n ...\n }\n\nNew in 2019.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "RedundantOperationOnEmptyContainer",
"cweIds": [
561
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AtomicFieldUpdaterNotStaticFinal",
"shortDescription": {
"text": "'AtomicFieldUpdater' field not declared 'static final'"
},
"fullDescription": {
"text": "Reports fields of types: 'java.util.concurrent.atomic.AtomicLongFieldUpdater' 'java.util.concurrent.atomic.AtomicIntegerFieldUpdater' 'java.util.concurrent.atomic.AtomicReferenceFieldUpdater' that are not 'static final'. Because only one atomic field updater is needed for updating a 'volatile' field in all instances of a class, it can almost always be 'static'. Making the updater 'final' allows the JVM to optimize access for improved performance. Example: 'class Main {\n private volatile int id;\n private AtomicIntegerFieldUpdater<Main> idFieldUpdater = AtomicIntegerFieldUpdater.newUpdater(Main.class, \"id\");\n }' After the quick-fix is applied: 'class Main {\n private volatile int id;\n private static final AtomicIntegerFieldUpdater<Main> idFieldUpdater = AtomicIntegerFieldUpdater.newUpdater(Main.class, \"id\");\n }'",
"markdown": "Reports fields of types:\n\n* `java.util.concurrent.atomic.AtomicLongFieldUpdater`\n* `java.util.concurrent.atomic.AtomicIntegerFieldUpdater`\n* `java.util.concurrent.atomic.AtomicReferenceFieldUpdater`\n\nthat are not `static final`. Because only one atomic field updater is needed for updating a `volatile` field in all instances of a class, it can almost always be `static`.\n\nMaking the updater `final` allows the JVM to optimize access for improved performance.\n\n**Example:**\n\n\n class Main {\n private volatile int id;\n private AtomicIntegerFieldUpdater<Main> idFieldUpdater = AtomicIntegerFieldUpdater.newUpdater(Main.class, \"id\");\n }\n\nAfter the quick-fix is applied:\n\n\n class Main {\n private volatile int id;\n private static final AtomicIntegerFieldUpdater<Main> idFieldUpdater = AtomicIntegerFieldUpdater.newUpdater(Main.class, \"id\");\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "AtomicFieldUpdaterNotStaticFinal",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java8MapForEach",
"shortDescription": {
"text": "Map.forEach() can be used"
},
"fullDescription": {
"text": "Suggests replacing 'for(Entry<?,?> entry : map.entrySet()) {...}' or 'map.entrySet().forEach(entry -> ...)' with 'map.forEach((key, value) -> ...)'. Example 'void print(Map<String, Integer> map) {\n map.entrySet().forEach(entry -> {\n String str = entry.getKey();\n System.out.println(str + \":\" + entry.getValue());\n });\n }' After the quick-fix is applied: 'void print(Map<String, Integer> map) {\n map.forEach((str, value) -> System.out.println(str + \":\" + value));\n }' When the Do not report loops option is enabled, only 'entrySet().forEach()' cases will be reported. However, the quick-fix action will be available for 'for'-loops as well. This inspection only reports if the language level of the project or module is 8 or higher. New in 2017.1",
"markdown": "Suggests replacing `for(Entry<?,?> entry : map.entrySet()) {...}` or `map.entrySet().forEach(entry -> ...)` with `map.forEach((key, value) -> ...)`.\n\nExample\n\n\n void print(Map<String, Integer> map) {\n map.entrySet().forEach(entry -> {\n String str = entry.getKey();\n System.out.println(str + \":\" + entry.getValue());\n });\n }\n\nAfter the quick-fix is applied:\n\n\n void print(Map<String, Integer> map) {\n map.forEach((str, value) -> System.out.println(str + \":\" + value));\n }\n\n\nWhen the **Do not report loops** option is enabled, only `entrySet().forEach()` cases will be reported.\nHowever, the quick-fix action will be available for `for`-loops as well.\n\nThis inspection only reports if the language level of the project or module is 8 or higher.\n\nNew in 2017.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "Java8MapForEach",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 8",
"index": 120,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RecordStoreResource",
"shortDescription": {
"text": "'RecordStore' opened but not safely closed"
},
"fullDescription": {
"text": "Reports Java ME 'javax.microedition.rms.RecordStore' resources that are not opened in front of a 'try' block and closed in the corresponding 'finally' block. Such resources may be inadvertently leaked if an exception is thrown before the resource is closed. This inspection is intended for Java ME and other highly resource constrained environments. Applying the results of this inspection without consideration might have negative effects on code clarity and design. Example: 'void foo1() throws RecordStoreException {\n RecordStore rs = RecordStore.openRecordStore(\"bar\", true); // warning\n }\n void foo2() throws RecordStoreException {\n RecordStore rs = RecordStore.openRecordStore(\"bar\", true); // no warning\n try {\n /* ... */\n } finally {\n rs.closeRecordStore();\n }\n }'",
"markdown": "Reports Java ME `javax.microedition.rms.RecordStore` resources that are not opened in front of a `try` block and closed in the corresponding `finally` block.\n\nSuch resources may be inadvertently leaked if an exception is thrown before the resource is closed.\n\n\nThis inspection is intended for Java ME and other highly resource constrained environments.\nApplying the results of this inspection without consideration might have negative effects on code clarity and design.\n\n**Example:**\n\n\n void foo1() throws RecordStoreException {\n RecordStore rs = RecordStore.openRecordStore(\"bar\", true); // warning\n }\n void foo2() throws RecordStoreException {\n RecordStore rs = RecordStore.openRecordStore(\"bar\", true); // no warning\n try {\n /* ... */\n } finally {\n rs.closeRecordStore();\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "RecordStoreOpenedButNotSafelyClosed",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance/Embedded",
"index": 167,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ObjectsEqualsCanBeSimplified",
"shortDescription": {
"text": "'Objects.equals()' can be replaced with 'equals()'"
},
"fullDescription": {
"text": "Reports calls to 'Objects.equals(a, b)' in which the first argument is statically known to be non-null. Such a call can be safely replaced with 'a.equals(b)' or 'a == b' if both arguments are primitives. Example: 'String defaultName = \"default\";\n boolean isDefault = Objects.equals(defaultName, name);' After the quick-fix is applied: 'String defaultName = \"default\";\n boolean isDefault = defaultName.equals(name);' New in 2018.3",
"markdown": "Reports calls to `Objects.equals(a, b)` in which the first argument is statically known to be non-null.\n\nSuch a call can be safely replaced with `a.equals(b)` or `a == b` if both arguments are primitives.\n\nExample:\n\n\n String defaultName = \"default\";\n boolean isDefault = Objects.equals(defaultName, name);\n\nAfter the quick-fix is applied:\n\n\n String defaultName = \"default\";\n boolean isDefault = defaultName.equals(name);\n\nNew in 2018.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "ObjectsEqualsCanBeSimplified",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassLoaderInstantiation",
"shortDescription": {
"text": "'ClassLoader' instantiation"
},
"fullDescription": {
"text": "Reports instantiations of the 'java.lang.ClassLoader' class. While often benign, any instantiations of 'ClassLoader' should be closely examined in any security audit. Example: 'Class<?> loadExtraClass(String name) throws Exception {\n try(URLClassLoader loader =\n new URLClassLoader(new URL[]{new URL(\"extraClasses/\")})) {\n return loader.loadClass(name);\n }\n }'",
"markdown": "Reports instantiations of the `java.lang.ClassLoader` class.\n\nWhile often benign, any instantiations of `ClassLoader` should be closely examined in any security audit.\n\n**Example:**\n\n Class<?> loadExtraClass(String name) throws Exception {\n try(URLClassLoader loader =\n new URLClassLoader(new URL[]{new URL(\"extraClasses/\")})) {\n return loader.loadClass(name);\n }\n }\n \n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassLoaderInstantiation",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Security",
"index": 38,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnresolvedClassReferenceRepair",
"shortDescription": {
"text": "Unresolved class reference"
},
"fullDescription": {
"text": "Reports an unresolved class reference. The quick-fix suggests trying to resolve reference.",
"markdown": "Reports an unresolved class reference.\n\nThe quick-fix suggests trying to resolve reference."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "UnresolvedClassReferenceRepair",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Abstraction issues",
"index": 86,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NativeMethods",
"shortDescription": {
"text": "Native method"
},
"fullDescription": {
"text": "Reports methods declared 'native'. Native methods are inherently unportable.",
"markdown": "Reports methods declared `native`. Native methods are inherently unportable."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NativeMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Portability",
"index": 95,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "EqualsWithItself",
"shortDescription": {
"text": "'equals()' called on itself"
},
"fullDescription": {
"text": "Reports calls to 'equals()', 'compareTo()' or similar, that compare an object for equality with itself. The method contracts of these methods specify that such calls will always return 'true' for 'equals()' or '0' for 'compareTo()'. The inspection also checks calls to 'Objects.equals()', 'Objects.deepEquals()', 'Arrays.equals()', 'Comparator.compare()', 'assertEquals()' methods of test frameworks (JUnit, TestNG, AssertJ), 'Integer.compare()', 'Integer.compareUnsigned()' and similar methods. Example: 'class Foo {\n boolean foo(Object o) {\n return o.equals(o); // warning\n }\n\n boolean bar(String[] ss) {\n return Arrays.equals(ss, ss); // warning\n }\n}' Use the option to report test assertions report only on non-extendable library classes (like 'String') and primitive types. This option can be useful, when testing 'equals()' methods.",
"markdown": "Reports calls to `equals()`, `compareTo()` or similar, that compare an object for equality with itself. The method contracts of these methods specify that such calls will always return `true` for `equals()` or `0` for `compareTo()`. The inspection also checks calls to `Objects.equals()`, `Objects.deepEquals()`, `Arrays.equals()`, `Comparator.compare()`, `assertEquals()` methods of test frameworks (JUnit, TestNG, AssertJ), `Integer.compare()`, `Integer.compareUnsigned()` and similar methods.\n\n**Example:**\n\n\n class Foo {\n boolean foo(Object o) {\n return o.equals(o); // warning\n }\n\n boolean bar(String[] ss) {\n return Arrays.equals(ss, ss); // warning\n }\n }\n\n\nUse the option to report test assertions report only on non-extendable library classes (like `String`) and primitive types.\nThis option can be useful, when testing `equals()` methods."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "EqualsWithItself",
"cweIds": [
571
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassInheritanceDepth",
"shortDescription": {
"text": "Class too deep in inheritance tree"
},
"fullDescription": {
"text": "Reports classes that are too deep in the inheritance hierarchy. Classes that are too deeply inherited may be confusing and indicate that a refactoring is necessary. All superclasses from a library are treated as a single superclass, libraries are considered unmodifiable. Use the Inheritance depth limit field to specify the maximum inheritance depth for a class.",
"markdown": "Reports classes that are too deep in the inheritance hierarchy.\n\nClasses that are too deeply inherited may be confusing and indicate that a refactoring is necessary.\n\nAll superclasses from a library are treated as a single superclass, libraries are considered unmodifiable.\n\nUse the **Inheritance depth limit** field to specify the maximum inheritance depth for a class."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassTooDeepInInheritanceTree",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class metrics",
"index": 123,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MarkedForRemoval",
"shortDescription": {
"text": "Usage of API marked for removal"
},
"fullDescription": {
"text": "Reports usages of deprecated APIs (classes, fields, and methods) that are marked for removal with '@Deprecated(forRemoval=true)'. The code that uses an API marked for removal may cause a runtime error with a future version of the API. That is why the recommended severity for this inspection is Error. You can change the severity to Warning if you want to use the same code highlighting as in ordinary deprecation. New in 2017.3",
"markdown": "Reports usages of deprecated APIs (classes, fields, and methods) that are marked for removal with `@Deprecated(`**forRemoval**`=true)`.\n\n\nThe code that uses an API marked for removal may cause a runtime error with a future version of the API. That is why\nthe recommended severity for this inspection is *Error*.\n\n\nYou can change the severity to *Warning* if you want to use the same code highlighting as in ordinary deprecation.\n\nNew in 2017.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "error",
"parameters": {
"suppressToolId": "removal",
"ideaSeverity": "ERROR",
"qodanaSeverity": "Critical"
}
},
"relationships": [
{
"target": {
"id": "Java/Code maturity",
"index": 56,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NestedConditionalExpression",
"shortDescription": {
"text": "Nested conditional expression"
},
"fullDescription": {
"text": "Reports nested conditional expressions as they may result in extremely confusing code. Example: 'int y = a == 10 ? b == 20 ? 10 : a : b;'",
"markdown": "Reports nested conditional expressions as they may result in extremely confusing code.\n\nExample:\n\n\n int y = a == 10 ? b == 20 ? 10 : a : b;\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NestedConditionalExpression",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "WhileCanBeForeach",
"shortDescription": {
"text": "'while' loop can be replaced with enhanced 'for' loop"
},
"fullDescription": {
"text": "Reports 'while' loops that iterate over collections and can be replaced with enhanced 'for' loops (foreach iteration syntax). Example: 'Iterator it = c.iterator();\n while(it.hasNext()) {\n Object obj = it.next();\n System.out.println(obj);\n }' Can be replaced with: 'for (Object obj : c) {\n System.out.println(obj);\n }' This inspection only reports if the language level of the project or module is 5 or higher.",
"markdown": "Reports `while` loops that iterate over collections and can be replaced with enhanced `for` loops (foreach iteration syntax).\n\n**Example:**\n\n\n Iterator it = c.iterator();\n while(it.hasNext()) {\n Object obj = it.next();\n System.out.println(obj);\n }\n\nCan be replaced with:\n\n\n for (Object obj : c) {\n System.out.println(obj);\n }\n\nThis inspection only reports if the language level of the project or module is 5 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "WhileLoopReplaceableByForEach",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 5",
"index": 119,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ImplicitNumericConversion",
"shortDescription": {
"text": "Implicit numeric conversion"
},
"fullDescription": {
"text": "Reports implicit conversion between numeric types. Implicit numeric conversion is not a problem in itself but, if unexpected, may cause difficulties when tracing bugs. Example: 'double m(int i) {\n return i * 10;\n }' After the quick-fix is applied: 'double m(int i) {\n return (double) (i * 10);\n }' Configure the inspection: Use the Ignore widening conversions option to ignore implicit conversion that cannot result in data loss (for example, 'int'->'long'). Use the Ignore conversions from and to 'char' option to ignore conversion from and to 'char'. The inspection will still report conversion from and to floating-point numbers. Use the Ignore conversion from constants and literals to make the inspection ignore conversion from literals and compile-time constants.",
"markdown": "Reports implicit conversion between numeric types.\n\nImplicit numeric conversion is not a problem in itself but, if unexpected, may cause difficulties when tracing bugs.\n\n**Example:**\n\n\n double m(int i) {\n return i * 10;\n }\n\nAfter the quick-fix is applied:\n\n\n double m(int i) {\n return (double) (i * 10);\n }\n\nConfigure the inspection:\n\n* Use the **Ignore widening conversions** option to ignore implicit conversion that cannot result in data loss (for example, `int`-\\>`long`).\n* Use the **Ignore conversions from and to 'char'** option to ignore conversion from and to `char`. The inspection will still report conversion from and to floating-point numbers.\n* Use the **Ignore conversion from constants and literals** to make the inspection ignore conversion from literals and compile-time constants."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ImplicitNumericConversion",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "BulkFileAttributesRead",
"shortDescription": {
"text": "Bulk 'Files.readAttributes()' call can be used"
},
"fullDescription": {
"text": "Reports multiple sequential 'java.io.File' attribute checks, such as: 'isDirectory()' 'isFile()' 'lastModified()' 'length()' Such calls can be replaced with a bulk 'Files.readAttributes()' call. This is usually more performant than multiple separate attribute checks. Example: 'boolean isNewFile(File file, long lastModified) throws IOException {\n return file.isFile() && file.lastModified() > lastModified;\n }' After the quick-fix is applied: 'boolean isNewFile(File file, long lastModified) throws IOException {\n var fileAttributes = Files.readAttributes(file.toPath(), BasicFileAttributes.class);\n return fileAttributes.isRegularFile() && fileAttributes.lastModifiedTime().toMillis() > lastModified;\n }' This inspection does not show a warning if 'IOException' is not handled in the current context, but the quick-fix is still available. Note that the replacements are usually not completely equivalent and should be applied with care. In particular, the behavior could differ if the file does not exist at all. This inspection only reports if the language level of the project or module is 7 or higher. New in 2022.1",
"markdown": "Reports multiple sequential `java.io.File` attribute checks, such as:\n\n* `isDirectory()`\n* `isFile()`\n* `lastModified()`\n* `length()`\n\nSuch calls can be replaced with a bulk `Files.readAttributes()` call. This is usually more performant than multiple separate attribute checks.\n\nExample:\n\n\n boolean isNewFile(File file, long lastModified) throws IOException {\n return file.isFile() && file.lastModified() > lastModified;\n }\n\nAfter the quick-fix is applied:\n\n\n boolean isNewFile(File file, long lastModified) throws IOException {\n var fileAttributes = Files.readAttributes(file.toPath(), BasicFileAttributes.class);\n return fileAttributes.isRegularFile() && fileAttributes.lastModifiedTime().toMillis() > lastModified;\n }\n\nThis inspection does not show a warning if `IOException` is not handled in the current context, but the quick-fix is still available.\n\nNote that the replacements are usually not completely equivalent and should be applied with care. In particular, the behavior could differ if\nthe file does not exist at all.\n\nThis inspection only reports if the language level of the project or module is 7 or higher.\n\nNew in 2022.1"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "BulkFileAttributesRead",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NotNullFieldNotInitialized",
"shortDescription": {
"text": "@NotNull field is not initialized"
},
"fullDescription": {
"text": "Reports fields annotated as not-null that are not initialized in the constructor. Example: 'public class MyClass {\n private @NotNull String value;\n\n public void setValue(@NotNull String value) {\n this.value = value;\n }\n\n public @NotNull String getValue() {\n return value;\n }\n}' Such fields may violate the not-null constraint. In the example above, the 'setValue' parameter is annotated as not-null, but 'getValue' may return null if the setter was not called. Configure the inspection: Use the Ignore fields which could be initialized implicitly option to control whether a warning should be issued if the field could be initialized implicitly (e.g. via a dependency injection). Use the Ignore fields initialized in setUp() method option to control whether a warning should be issued if the field is written in the test case 'setUp()' method.",
"markdown": "Reports fields annotated as not-null that are not initialized in the constructor.\n\nExample:\n\n public class MyClass {\n private @NotNull String value;\n\n public void setValue(@NotNull String value) {\n this.value = value;\n }\n\n public @NotNull String getValue() {\n return value;\n }\n }\n\n\nSuch fields may violate the not-null constraint. In the example above, the `setValue` parameter is annotated as not-null, but\n`getValue` may return null if the setter was not called.\n\nConfigure the inspection:\n\n* Use the **Ignore fields which could be initialized implicitly** option to control whether a warning should be issued if the field could be initialized implicitly (e.g. via a dependency injection).\n* Use the **Ignore fields initialized in setUp() method** option to control whether a warning should be issued if the field is written in the test case `setUp()` method."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "NotNullFieldNotInitialized",
"cweIds": [
476
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs/Nullability problems",
"index": 169,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OverlyComplexBooleanExpression",
"shortDescription": {
"text": "Overly complex boolean expression"
},
"fullDescription": {
"text": "Reports boolean expressions with too many terms. Such expressions may be confusing and bug-prone. Example: 'cond(x1) && cond(x2) ^ cond(x3) && cond(x4);' Configure the inspection: Use the Maximum number of terms field to specify the maximum number of terms allowed in a boolean expression. Use the Ignore pure conjunctions and disjunctions option to ignore boolean expressions which use only a single boolean operator repeatedly.",
"markdown": "Reports boolean expressions with too many terms. Such expressions may be confusing and bug-prone.\n\nExample:\n\n\n cond(x1) && cond(x2) ^ cond(x3) && cond(x4);\n\nConfigure the inspection:\n\n* Use the **Maximum number of terms** field to specify the maximum number of terms allowed in a boolean expression.\n* Use the **Ignore pure conjunctions and disjunctions** option to ignore boolean expressions which use only a single boolean operator repeatedly."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OverlyComplexBooleanExpression",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NotifyCalledOnCondition",
"shortDescription": {
"text": "'notify()' or 'notifyAll()' called on 'java.util.concurrent.locks.Condition' object"
},
"fullDescription": {
"text": "Reports calls to 'notify()' or 'notifyAll()' made on 'java.util.concurrent.locks.Condition' object. This is probably a programming error, and some variant of the 'signal()' or 'signalAll()' method was intended instead, otherwise 'IllegalMonitorStateException' may occur. Example: 'class C {\n final Lock l = new ReentrantLock();\n final Condition c = l.newCondition();\n\n void release() {\n l.lock();\n try {\n c.notifyAll(); // probably 'signalAll()' was intended here\n } finally {\n l.unlock();\n }\n }\n }'",
"markdown": "Reports calls to `notify()` or `notifyAll()` made on `java.util.concurrent.locks.Condition` object.\n\n\nThis is probably a programming error, and some variant of the `signal()` or\n`signalAll()` method was intended instead, otherwise `IllegalMonitorStateException` may occur.\n\n**Example:**\n\n\n class C {\n final Lock l = new ReentrantLock();\n final Condition c = l.newCondition();\n\n void release() {\n l.lock();\n try {\n c.notifyAll(); // probably 'signalAll()' was intended here\n } finally {\n l.unlock();\n }\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NotifyCalledOnCondition",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NewMethodNamingConvention",
"shortDescription": {
"text": "Method naming convention"
},
"fullDescription": {
"text": "Reports methods whose names are too short, too long, or do not follow the specified regular expression pattern. Instance methods that override library methods and constructors are ignored by this inspection. Example: if the inspection is enabled for static methods, and the minimum specified method name length is 4 (the default), the following static method produces a warning, because the length of its name is 3, which is less than 4: 'public static int max(int a, int b)'. A quick-fix that renames such methods is available only in the editor. Configure the inspection: Use the list in the Options section to specify which methods should be checked. Deselect the checkboxes for the method types for which you want to skip the check. Specify 0 in the length fields to skip the corresponding checks. Regular expressions should be specified in the standard 'java.util.regex' format.",
"markdown": "Reports methods whose names are too short, too long, or do not follow the specified regular expression pattern.\n\nInstance methods that override library\nmethods and constructors are ignored by this inspection.\n\n**Example:** if the inspection is enabled for static methods, and the minimum specified method name length is 4 (the default),\nthe following static method produces a warning, because the length of its name is 3, which is less\nthan 4: `public static int max(int a, int b)`.\n\nA quick-fix that renames such methods is available only in the editor.\n\nConfigure the inspection:\n\nUse the list in the **Options** section to specify which methods should be checked. Deselect the checkboxes for the method types for which\nyou want to skip the check. Specify **0** in the length fields to skip the corresponding checks.\n\nRegular expressions should be specified in the standard `java.util.regex` format."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NewMethodNamingConvention",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Naming conventions/Method",
"index": 108,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OverlyStrongTypeCast",
"shortDescription": {
"text": "Overly strong type cast"
},
"fullDescription": {
"text": "Reports type casts that are overly strong. For instance, casting an object to 'ArrayList' when casting it to 'List' would do just as well. Note: much like the Redundant type cast inspection, applying the fix for this inspection may change the semantics of your program if you are intentionally using an overly strong cast to cause a 'ClassCastException' to be generated. Example: 'interface Super {\n void doSmth();\n }\n interface Sub extends Super { }\n\n void use(Object obj) {\n // Warning: ((Super)obj).doSmth() could be used\n ((Sub)obj).doSmth();\n }' Use the checkbox below to ignore casts when there's a matching 'instanceof' check in the code.",
"markdown": "Reports type casts that are overly strong. For instance, casting an object to `ArrayList` when casting it to `List` would do just as well.\n\n\n**Note:** much like the *Redundant type cast*\ninspection, applying the fix for this inspection may change the semantics of your program if you are\nintentionally using an overly strong cast to cause a `ClassCastException` to be generated.\n\nExample:\n\n\n interface Super {\n void doSmth();\n }\n interface Sub extends Super { }\n\n void use(Object obj) {\n // Warning: ((Super)obj).doSmth() could be used\n ((Sub)obj).doSmth();\n }\n\n\nUse the checkbox below to ignore casts when there's a matching `instanceof` check in the code."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OverlyStrongTypeCast",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Abstraction issues",
"index": 86,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavaLangImport",
"shortDescription": {
"text": "Unnecessary import from the 'java.lang' package"
},
"fullDescription": {
"text": "Reports 'import' statements that refer to the 'java.lang' package. 'java.lang' classes are always implicitly imported, so such import statements are redundant and confusing. Since IntelliJ IDEA can automatically detect and fix such statements with its Optimize Imports command, this inspection is mostly useful for offline reporting on code bases that you don't intend to change.",
"markdown": "Reports `import` statements that refer to the `java.lang` package.\n\n\n`java.lang` classes are always implicitly imported, so such import statements are\nredundant and confusing.\n\n\nSince IntelliJ IDEA can automatically detect and fix such statements with its **Optimize Imports** command, this inspection is mostly useful for offline reporting on code bases that you don't intend to change."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "JavaLangImport",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Imports",
"index": 24,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UtilityClass",
"shortDescription": {
"text": "Utility class"
},
"fullDescription": {
"text": "Reports utility classes. Utility classes have all fields and methods declared as 'static' and their presence may indicate a lack of object-oriented design. Use the Ignore if annotated by option to specify special annotations. The inspection ignores classes annotated with one of these annotations.",
"markdown": "Reports utility classes.\n\nUtility classes have all fields and methods declared as `static` and their\npresence may indicate a lack of object-oriented design.\n\n\nUse the **Ignore if annotated by** option to specify special annotations. The inspection ignores classes annotated with one of\nthese annotations."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UtilityClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassNameDiffersFromFileName",
"shortDescription": {
"text": "Class name differs from file name"
},
"fullDescription": {
"text": "Reports top-level class names that don't match the name of a file containing them. While the Java specification allows for naming non-'public' classes this way, files with unmatched names may be confusing and decrease usefulness of various software tools.",
"markdown": "Reports top-level class names that don't match the name of a file containing them.\n\nWhile the Java specification allows for naming non-`public` classes this way,\nfiles with unmatched names may be confusing and decrease usefulness of various software tools."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassNameDiffersFromFileName",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "IndexOfReplaceableByContains",
"shortDescription": {
"text": "'String.indexOf()' expression can be replaced with 'contains()'"
},
"fullDescription": {
"text": "Reports comparisons with 'String.indexOf()' calls that can be replaced with a call to the 'String.contains()' method. Example: 'boolean b = \"abcd\".indexOf('e') >= 0;' After the quick-fix is applied: 'boolean b = \"abcd\".contains('e');' This inspection only reports if the language level of the project or module is 5 or higher.",
"markdown": "Reports comparisons with `String.indexOf()` calls that can be replaced with a call to the `String.contains()` method.\n\n**Example:**\n\n\n boolean b = \"abcd\".indexOf('e') >= 0;\n\nAfter the quick-fix is applied:\n\n\n boolean b = \"abcd\".contains('e');\n\nThis inspection only reports if the language level of the project or module is 5 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "IndexOfReplaceableByContains",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 5",
"index": 119,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StringConcatenationArgumentToLogCall",
"shortDescription": {
"text": "Non-constant string concatenation as argument to logging call"
},
"fullDescription": {
"text": "Reports non-constant string concatenations that are used as arguments to SLF4J and Log4j 2 logging methods. Non-constant concatenations are evaluated at runtime even when the logging message is not logged; this can negatively impact performance. It is recommended to use a parameterized log message instead, which will not be evaluated when logging is disabled. Example: 'public class Vital {\n private static final Logger LOG = LoggerFactory.getLogger(Vital.class);\n\n public void saveTheWorld(int i, String s, boolean b) {\n LOG.info(\"saveTheWorld(\" + i + \", \" + s + \", \" + b + \")\");\n // todo\n }\n }' After the quick-fix is applied: 'public class Vital {\n private static final Logger LOG = LoggerFactory.getLogger(Vital.class);\n\n public void saveTheWorld(int i, String s, boolean b) {\n LOG.info(\"saveTheWorld({}, {}, {})\", i, s, b);\n // todo\n }\n }' Configure the inspection: Use the Warn on list to ignore certain higher logging levels. Higher logging levels may be enabled even in production, and the arguments will always be evaluated.",
"markdown": "Reports non-constant string concatenations that are used as arguments to **SLF4J** and **Log4j 2** logging methods. Non-constant concatenations are evaluated at runtime even when the logging message is not logged; this can negatively impact performance. It is recommended to use a parameterized log message instead, which will not be evaluated when logging is disabled.\n\n**Example:**\n\n\n public class Vital {\n private static final Logger LOG = LoggerFactory.getLogger(Vital.class);\n\n public void saveTheWorld(int i, String s, boolean b) {\n LOG.info(\"saveTheWorld(\" + i + \", \" + s + \", \" + b + \")\");\n // todo\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Vital {\n private static final Logger LOG = LoggerFactory.getLogger(Vital.class);\n\n public void saveTheWorld(int i, String s, boolean b) {\n LOG.info(\"saveTheWorld({}, {}, {})\", i, s, b);\n // todo\n }\n }\n\n\nConfigure the inspection:\n\n* Use the **Warn on** list to ignore certain higher logging levels. Higher logging levels may be enabled even in production, and the arguments will always be evaluated."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "StringConcatenationArgumentToLogCall",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Logging",
"index": 77,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OptionalContainsCollection",
"shortDescription": {
"text": "'Optional' contains array or collection"
},
"fullDescription": {
"text": "Reports 'java.util.Optional' or 'com.google.common.base.Optional' types with an array or collection type parameter. In such cases, it is more clear to just use an empty array or collection to indicate the absence of result. Example: 'Optional<List<Integer>> foo() {\n return Optional.empty();\n }' This code could look like: 'List<Integer> foo() {\n return new List<>();\n }'",
"markdown": "Reports `java.util.Optional` or `com.google.common.base.Optional` types with an array or collection type parameter.\n\nIn such cases, it is more clear to just use an empty array or collection to indicate the absence of result.\n\n**Example:**\n\n\n Optional<List<Integer>> foo() {\n return Optional.empty();\n }\n\nThis code could look like:\n\n\n List<Integer> foo() {\n return new List<>();\n }\n \n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OptionalContainsCollection",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SimplifiableAssertion",
"shortDescription": {
"text": "Simplifiable assertion"
},
"fullDescription": {
"text": "Reports any 'assert' calls that can be replaced with simpler and equivalent calls. Example → Replacement 'assertEquals(true, x());' 'assertTrue(x());' 'assertTrue(y() != null);' 'assertNotNull(y());' 'assertTrue(z == z());' 'assertSame(z, z());' 'assertTrue(a.equals(a()));' 'assertEquals(a, a());' 'assertTrue(false);' 'fail();'",
"markdown": "Reports any `assert` calls that can be replaced with simpler and equivalent calls.\n\n| Example | → | Replacement |\n|----------------------------------|---|-------------------------|\n| `assertEquals(`**true**`, x());` | | `assertTrue(x());` |\n| `assertTrue(y() != null);` | | `assertNotNull(y());` |\n| `assertTrue(z == z());` | | `assertSame(z, z());` |\n| `assertTrue(a.equals(a()));` | | `assertEquals(a, a());` |\n| `assertTrue(`**false**`);` | | `fail();` |"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SimplifiableAssertion",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Test frameworks",
"index": 127,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InterfaceMethodClashesWithObject",
"shortDescription": {
"text": "Interface method clashes with method in 'Object'"
},
"fullDescription": {
"text": "Reports interface methods that clash with the protected methods 'clone()' and 'finalize()' from the 'java.lang.Object' class. In an interface, it is possible to declare these methods with a return type that is incompatible with the 'java.lang.Object' methods. A class that implements such an interface will not be compilable. When the interface is functional, it remains possible to create a lambda from it, but this is not recommended. Example: '// Warning: this interface cannot be implemented\n // by any class, only by a lambda or method reference\n interface MyInterface {\n double clone();\n }'",
"markdown": "Reports interface methods that clash with the **protected** methods `clone()` and `finalize()` from the `java.lang.Object` class.\n\nIn an interface, it is possible to declare these methods with a return type that is incompatible with the `java.lang.Object` methods.\nA class that implements such an interface will not be compilable.\nWhen the interface is functional, it remains possible to create a lambda from it, but this is not recommended.\n\nExample:\n\n\n // Warning: this interface cannot be implemented\n // by any class, only by a lambda or method reference\n interface MyInterface {\n double clone();\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "InterfaceMethodClashesWithObject",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Abstraction issues",
"index": 86,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LoadLibraryWithNonConstantString",
"shortDescription": {
"text": "Call to 'System.loadLibrary()' with non-constant string"
},
"fullDescription": {
"text": "Reports calls to 'java.lang.System.loadLibrary()', 'java.lang.System.load()', 'java.lang.Runtime.loadLibrary()' and 'java.lang.Runtime.load()' which take a dynamically-constructed string as the name of the library. Constructed library name strings are a common source of security breaches. By default, this inspection ignores compile-time constants. Example: 'void test(int i) {\n System.loadLibrary(\"foo\" + i);\n }' Use the inspection settings to consider any 'static final' fields as constant. Be careful, because strings like the following will be ignored when the option is enabled: 'private static final String LIBRARY = getUserInput();'",
"markdown": "Reports calls to `java.lang.System.loadLibrary()`, `java.lang.System.load()`, `java.lang.Runtime.loadLibrary()` and `java.lang.Runtime.load()` which take a dynamically-constructed string as the name of the library.\n\n\nConstructed library name strings are a common source of security breaches.\nBy default, this inspection ignores compile-time constants.\n\n**Example:**\n\n\n void test(int i) {\n System.loadLibrary(\"foo\" + i);\n }\n\n\nUse the inspection settings to consider any `static final` fields as constant.\nBe careful, because strings like the following will be ignored when the option is enabled:\n\n\n private static final String LIBRARY = getUserInput();\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "LoadLibraryWithNonConstantString",
"cweIds": [
114,
494,
676,
829
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Security",
"index": 38,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StaticMethodOnlyUsedInOneClass",
"shortDescription": {
"text": "Static member only used from one other class"
},
"fullDescription": {
"text": "Reports 'static' methods and fields that are only used from a class other than the containing class. Such members could be moved into the using class. Factory methods and members accessed from an anonymous class inside the member's class are ignored by this inspection. Convenience overloads, which call a method with the same name in the same class but have fewer parameters, are also ignored. Use the first checkbox to suppress this inspection when the static member is only used from a test class. Use the second checkbox below to ignore member usages from inside anonymous, local, or non-static inner classes. Use the third checkbox below to not warn on members that cannot be moved without problems, for example, because a method with an identical signature is already present in the target class, or because a field or a method used inside the method will not be accessible when this method is moved. Use the fourth checkbox to ignore members located in utility classes.",
"markdown": "Reports `static` methods and fields that are only used from a class other than the containing class. Such members could be moved into the using class. Factory methods and members accessed from an anonymous class inside the member's class are ignored by this inspection. Convenience overloads, which call a method with the same name in the same class but have fewer parameters, are also ignored.\n\n\nUse the first checkbox to suppress this inspection when the static member is only used from a test class.\n\n\nUse the second checkbox below to ignore member usages from inside anonymous, local, or non-static inner classes.\n\n\nUse the third checkbox below to not warn on members that cannot be moved without problems,\nfor example, because a method with an identical signature is already present in the target class,\nor because a field or a method used inside the method will not be accessible when this method is moved.\n\n\nUse the fourth checkbox to ignore members located in utility classes."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "StaticMethodOnlyUsedInOneClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Abstraction issues",
"index": 86,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RedundantEscapeInRegexReplacement",
"shortDescription": {
"text": "Redundant escape in regex replacement string"
},
"fullDescription": {
"text": "Reports redundant escapes in the replacement string of regex methods. It is allowed to escape any character in a regex replacement string, but only for the '$' and '\\' characters is escaping necessary. Example: 'string.replaceAll(\"a\", \"\\\\b\");' After the quick-fix is applied: 'string.replaceAll(\"a\", \"b\");' New in 2022.3",
"markdown": "Reports redundant escapes in the replacement string of regex methods. It is allowed to escape any character in a regex replacement string, but only for the `$` and `\\` characters is escaping necessary.\n\n**Example:**\n\n\n string.replaceAll(\"a\", \"\\\\b\");\n\nAfter the quick-fix is applied:\n\n\n string.replaceAll(\"a\", \"b\");\n\nNew in 2022.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "RedundantEscapeInRegexReplacement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SynchronizedOnLiteralObject",
"shortDescription": {
"text": "Synchronization on an object initialized with a literal"
},
"fullDescription": {
"text": "Reports 'synchronized' blocks that lock on an object initialized with a literal. String literals are interned and 'Character', 'Boolean' and 'Number' literals can be allocated from a cache. Because of this, it is possible that some other part of the system, which uses an object initialized with the same literal, is actually holding a reference to the exact same object. This can create unexpected dead-lock situations, if the lock object was thought to be private. Example: 'class Main {\n final String mutex = \"Mutex\";\n void method() {\n synchronized (mutex) {\n }\n }\n }' Use the Warn on all possible literals option to report any synchronization on 'String', 'Character', 'Boolean' and 'Number' objects.",
"markdown": "Reports `synchronized` blocks that lock on an object initialized with a literal.\n\n\nString literals are interned and `Character`, `Boolean` and `Number` literals can be allocated from a cache.\nBecause of this, it is possible that some other part of the system, which uses an object initialized with the same literal, is actually\nholding a reference to the exact same object. This can create unexpected dead-lock situations, if the lock object was thought to be private.\n\n**Example:**\n\n\n class Main {\n final String mutex = \"Mutex\";\n void method() {\n synchronized (mutex) {\n }\n }\n }\n\n\nUse the **Warn on all possible literals** option to report any synchronization on\n`String`, `Character`, `Boolean` and `Number` objects."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SynchronizedOnLiteralObject",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Java9ReflectionClassVisibility",
"shortDescription": {
"text": "Reflective access across modules issues"
},
"fullDescription": {
"text": "Reports 'Class.forName()' and 'ClassLoader.loadClass()' calls which try to access classes that aren't visible in the current scope due to Java 9 module accessibility rules. This inspection only reports if the language level of the project or module is 9 or higher.",
"markdown": "Reports `Class.forName()` and `ClassLoader.loadClass()` calls which try to access classes that aren't visible in the current scope due to Java 9 module accessibility rules.\n\nThis inspection only reports if the language level of the project or module is 9 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "Java9ReflectionClassVisibility",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Reflective access",
"index": 128,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CharsetObjectCanBeUsed",
"shortDescription": {
"text": "Standard 'Charset' object can be used"
},
"fullDescription": {
"text": "Reports methods and constructors in which constant charset 'String' literal (for example, '\"UTF-8\"') can be replaced with the predefined 'StandardCharsets.UTF_8' code. The code after the fix may work faster, because the charset lookup becomes unnecessary. Also, catching 'UnsupportedEncodingException' may become unnecessary as well. In this case, the catch block will be removed automatically. Example: 'try {\n byte[] bytes = \"str\".getBytes(\"UTF-8\");\n } catch (UnsupportedEncodingException e) {\n }' After quick-fix is applied: 'byte[] bytes = \"str\".getBytes(StandardCharsets.UTF_8);' The inspection is available in Java 7 and later. New in 2018.2",
"markdown": "Reports methods and constructors in which constant charset `String` literal (for example, `\"UTF-8\"`) can be replaced with the predefined `StandardCharsets.UTF_8` code.\n\nThe code after the fix may work faster, because the charset lookup becomes unnecessary.\nAlso, catching `UnsupportedEncodingException` may become unnecessary as well. In this case,\nthe catch block will be removed automatically.\n\nExample:\n\n\n try {\n byte[] bytes = \"str\".getBytes(\"UTF-8\");\n } catch (UnsupportedEncodingException e) {\n }\n\nAfter quick-fix is applied:\n\n\n byte[] bytes = \"str\".getBytes(StandardCharsets.UTF_8);\n\nThe inspection is available in Java 7 and later.\n\nNew in 2018.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "CharsetObjectCanBeUsed",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UseOfSunClasses",
"shortDescription": {
"text": "Use of 'sun.*' classes"
},
"fullDescription": {
"text": "Reports uses of classes from the 'sun.*' hierarchy. Such classes are non-portable between different JVMs.",
"markdown": "Reports uses of classes from the `sun.*` hierarchy. Such classes are non-portable between different JVMs."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UseOfSunClasses",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Portability",
"index": 95,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "RedundantCast",
"shortDescription": {
"text": "Redundant type cast"
},
"fullDescription": {
"text": "Reports unnecessary cast expressions. Example: 'static Object toObject(String s) {\n return (Object) s;\n }' Use the checkbox below to ignore clarifying casts e.g., casts in collection calls where 'Object' is expected: 'static void removeFromList(List<String> l, Object o) {\n l.remove((String)o);\n }'",
"markdown": "Reports unnecessary cast expressions.\n\nExample:\n\n\n static Object toObject(String s) {\n return (Object) s;\n }\n\n\nUse the checkbox below to ignore clarifying casts e.g., casts in collection calls where `Object` is expected:\n\n\n static void removeFromList(List<String> l, Object o) {\n l.remove((String)o);\n } \n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "RedundantCast",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AnonymousInnerClass",
"shortDescription": {
"text": "Anonymous inner class can be replaced with inner class"
},
"fullDescription": {
"text": "Reports anonymous inner classes. In some cases, replacing anonymous inner classes with inner classes can lead to more readable and maintainable code. Also, some code standards discourage anonymous inner classes.",
"markdown": "Reports anonymous inner classes.\n\nIn some cases, replacing anonymous inner classes with inner classes can lead to more readable and maintainable code.\nAlso, some code standards discourage anonymous inner classes."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AnonymousInnerClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SimplifyCollector",
"shortDescription": {
"text": "Simplifiable collector"
},
"fullDescription": {
"text": "Reports collectors that can be simplified. In particular, some cascaded 'groupingBy()' collectors can be expressed by using a simpler 'toMap()' collector, which is also likely to be more performant. Example: 'Collectors.groupingByConcurrent(String::length, Collectors.collectingAndThen(Collectors.maxBy(String::compareTo), Optional::get));' After the quick-fix is applied: 'Collectors.toConcurrentMap(String::length, Function.identity(), BinaryOperator.maxBy(String::compareTo));' This inspection only reports if the language level of the project or module is 8 or higher. New in 2017.1",
"markdown": "Reports collectors that can be simplified.\n\nIn particular, some cascaded `groupingBy()` collectors can be expressed by using a\nsimpler `toMap()` collector, which is also likely to be more performant.\n\nExample:\n\n\n Collectors.groupingByConcurrent(String::length, Collectors.collectingAndThen(Collectors.maxBy(String::compareTo), Optional::get));\n\nAfter the quick-fix is applied:\n\n\n Collectors.toConcurrentMap(String::length, Function.identity(), BinaryOperator.maxBy(String::compareTo));\n\nThis inspection only reports if the language level of the project or module is 8 or higher.\n\nNew in 2017.1"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SimplifyCollector",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Verbose or redundant code constructs",
"index": 47,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MultipleTopLevelClassesInFile",
"shortDescription": {
"text": "Multiple top level classes in single file"
},
"fullDescription": {
"text": "Reports multiple top-level classes in a single Java file. Putting multiple top-level classes in one file may be confusing and degrade the usefulness of various software tools.",
"markdown": "Reports multiple top-level classes in a single Java file.\n\nPutting multiple\ntop-level classes in one file may be confusing and degrade the usefulness of various\nsoftware tools."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "MultipleTopLevelClassesInFile",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "IteratorNextDoesNotThrowNoSuchElementException",
"shortDescription": {
"text": "'Iterator.next()' which can't throw 'NoSuchElementException'"
},
"fullDescription": {
"text": "Reports implementations of 'Iterator.next()' that cannot throw 'java.util.NoSuchElementException'. Such implementations violate the contract of 'java.util.Iterator', and may result in subtle bugs if the iterator is used in a non-standard way. Example: 'class Numbers implements Iterator<Integer> {\n @Override\n public Integer next() { //warning\n if (hasNext()) {\n return generateNext();\n } else {\n return null; //throw NoSuchElementException instead\n }\n }\n\n ...\n }'",
"markdown": "Reports implementations of `Iterator.next()` that cannot throw `java.util.NoSuchElementException`.\n\n\nSuch implementations violate the contract of `java.util.Iterator`,\nand may result in subtle bugs if the iterator is used in a non-standard way.\n\n**Example:**\n\n\n class Numbers implements Iterator<Integer> {\n @Override\n public Integer next() { //warning\n if (hasNext()) {\n return generateNext();\n } else {\n return null; //throw NoSuchElementException instead\n }\n }\n\n ...\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "IteratorNextCanNotThrowNoSuchElementException",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "IncorrectMessageFormat",
"shortDescription": {
"text": "Incorrect 'MessageFormat' pattern"
},
"fullDescription": {
"text": "Reports incorrect message format patterns or incorrect indexes of placeholders The following errors are reported: Unparsed or negative index Unclosed brace Unpaired quote. In this case, a part of a pattern may not be used Probably incorrect number of quotes Incorrect lower bound of nested choice patterns Incorrect indexes of placeholders. In this case, a placeholder may not be substituted or an argument may not be used Examples: 'MessageFormat.format(\"{wrong}\", 1); // incorrect index\n MessageFormat.format(\"{0\", 1); // Unmatched brace\n MessageFormat.format(\"'{0}\", 1); // Unpaired quote\n MessageFormat.format(\"It''''s {0}\", 1); // \"It''s\" will be printed, instead of \"It's\"\n MessageFormat.format(\"{0}\", 1, 2); // The argument with index '1' is not used in the pattern' New in 2023.2",
"markdown": "Reports incorrect message format patterns or incorrect indexes of placeholders\n\nThe following errors are reported:\n\n* Unparsed or negative index\n* Unclosed brace\n* Unpaired quote. In this case, a part of a pattern may not be used\n* Probably incorrect number of quotes\n* Incorrect lower bound of nested choice patterns\n* Incorrect indexes of placeholders. In this case, a placeholder may not be substituted or an argument may not be used\n\nExamples:\n\n\n MessageFormat.format(\"{wrong}\", 1); // incorrect index\n MessageFormat.format(\"{0\", 1); // Unmatched brace\n MessageFormat.format(\"'{0}\", 1); // Unpaired quote\n MessageFormat.format(\"It''''s {0}\", 1); // \"It''s\" will be printed, instead of \"It's\"\n MessageFormat.format(\"{0}\", 1, 2); // The argument with index '1' is not used in the pattern\n\nNew in 2023.2"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "IncorrectMessageFormat",
"cweIds": [
628,
707
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SuspiciousTernaryOperatorInVarargsCall",
"shortDescription": {
"text": "Suspicious ternary operator in varargs method call"
},
"fullDescription": {
"text": "Reports vararg method calls that use a ternary operator with mixed array and non-array branches. When compiled, both branches are wrapped in arrays. As a result, the array branch is turned into a two-dimensional array, which may indicate a problem. The quick-fix wraps the non-array branch in an array to prevent the compiler from doing the conversion. Example: 'static void bar(boolean flag) {\n Object[] a = {1, 2};\n Object b = \"hello\";\n foo(flag ? a : b);\n }\n static void foo(Object... obj) {\n }' After the quick-fix: 'static void bar(boolean flag) {\n Object[] a = {1, 2};\n Object b = \"hello\";\n foo(flag ? a : new Object[]{b});\n }\n static void foo(Object... obj) {\n }' New in 2020.3",
"markdown": "Reports vararg method calls that use a ternary operator with mixed array and non-array branches.\n\n\nWhen compiled, both branches are wrapped in arrays. As a result, the array branch is turned into\na two-dimensional array, which may indicate a problem.\n\n\nThe quick-fix wraps the non-array branch in an array to prevent the compiler from doing the conversion.\n\n**Example:**\n\n\n static void bar(boolean flag) {\n Object[] a = {1, 2};\n Object b = \"hello\";\n foo(flag ? a : b);\n }\n static void foo(Object... obj) {\n }\n\nAfter the quick-fix:\n\n\n static void bar(boolean flag) {\n Object[] a = {1, 2};\n Object b = \"hello\";\n foo(flag ? a : new Object[]{b});\n }\n static void foo(Object... obj) {\n }\n\nNew in 2020.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SuspiciousTernaryOperatorInVarargsCall",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SerializableInnerClassHasSerialVersionUIDField",
"shortDescription": {
"text": "Serializable non-static inner class without 'serialVersionUID'"
},
"fullDescription": {
"text": "Reports non-static inner classes that implement 'java.io.Serializable', but do not define a 'serialVersionUID' field. Without a 'serialVersionUID' field, any change to the class will make previously serialized versions unreadable. It is strongly recommended that 'Serializable' non-static inner classes have a 'serialVersionUID' field, otherwise the default serialization algorithm may result in serialized versions being incompatible between compilers due to differences in synthetic accessor methods. A quick-fix is suggested to add the missing 'serialVersionUID' field. Example: 'class Outer {\n class Inner implements Serializable {}\n }' After the quick-fix is applied: 'class Outer {\n class Inner implements Serializable {\n private static final long serialVersionUID = -7004458730436243902L;\n }\n }' Use the following options to configure the inspection: List classes whose inheritors should not be reported by this inspection. This is meant for classes that inherit 'Serializable' from a superclass but are not intended for serialization. Whether to ignore 'Serializable' anonymous classes.",
"markdown": "Reports non-static inner classes that implement `java.io.Serializable`, but do not define a `serialVersionUID` field.\n\n\nWithout a `serialVersionUID` field, any change to the class will make previously\nserialized versions unreadable. It is strongly recommended that `Serializable`\nnon-static inner classes have a `serialVersionUID` field, otherwise the default\nserialization algorithm may result in serialized versions being incompatible between\ncompilers due to differences in synthetic accessor methods.\n\n\nA quick-fix is suggested to add the missing `serialVersionUID` field.\n\n**Example:**\n\n\n class Outer {\n class Inner implements Serializable {}\n }\n\nAfter the quick-fix is applied:\n\n\n class Outer {\n class Inner implements Serializable {\n private static final long serialVersionUID = -7004458730436243902L;\n }\n }\n\nUse the following options to configure the inspection:\n\n* List classes whose inheritors should not be reported by this inspection. This is meant for classes that inherit `Serializable` from a superclass but are not intended for serialization.\n* Whether to ignore `Serializable` anonymous classes."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SerializableNonStaticInnerClassWithoutSerialVersionUID",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Serialization issues",
"index": 20,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ParameterNameDiffersFromOverriddenParameter",
"shortDescription": {
"text": "Parameter name differs from parameter in overridden or overloaded method"
},
"fullDescription": {
"text": "Reports parameters whose names differ from the corresponding parameters of the methods they override or overload. While legal in Java, such inconsistent names may be confusing and decrease the documentation benefits of good naming practices. Example: 'class Person {\n Person(String fullName) {}\n }\n class Child extends Person {\n Child(String name) { super(name); }\n }' After the quick-fix is applied: 'class Person {\n Person(String fullName) {}\n }\n class Child extends Person {\n Child(String fullName) { super(fullName); }\n }' Use the options to indicate whether to ignore overridden parameter names that are only a single character long or come from a library method. Both can be useful if you do not wish to be bound by dubious naming conventions used in libraries.",
"markdown": "Reports parameters whose names differ from the corresponding parameters of the methods they override or overload. While legal in Java, such inconsistent names may be confusing and decrease the documentation benefits of good naming practices.\n\n**Example:**\n\n\n class Person {\n Person(String fullName) {}\n }\n class Child extends Person {\n Child(String name) { super(name); }\n }\n\nAfter the quick-fix is applied:\n\n\n class Person {\n Person(String fullName) {}\n }\n class Child extends Person {\n Child(String fullName) { super(fullName); }\n }\n\n\nUse the options to indicate whether to ignore overridden parameter names that are only\na single character long or come from a library method. Both can be useful if\nyou do not wish to be bound by dubious naming conventions used in libraries."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ParameterNameDiffersFromOverriddenParameter",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Naming conventions",
"index": 81,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "OctalLiteral",
"shortDescription": {
"text": "Octal integer"
},
"fullDescription": {
"text": "Reports octal integer literals. Some coding standards prohibit the use of octal literals, as they may be easily confused with decimal literals. Example: 'int i = 015;\n int j = 0_777;' This inspection has two different quick-fixes. After the Convert octal literal to decimal literal quick-fix is applied, the code changes to: 'int i = 13;\n int j = 511;' After the Remove leading zero to make decimal quick-fix is applied, the code changes to: 'int i = 15;\n int j = 777;'",
"markdown": "Reports octal integer literals. Some coding standards prohibit the use of octal literals, as they may be easily confused with decimal literals.\n\nExample:\n\n\n int i = 015;\n int j = 0_777;\n\nThis inspection has two different quick-fixes.\nAfter the **Convert octal literal to decimal literal** quick-fix is applied, the code changes to:\n\n\n int i = 13;\n int j = 511;\n\nAfter the **Remove leading zero to make decimal** quick-fix is applied, the code changes to:\n\n\n int i = 15;\n int j = 777;\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "OctalInteger",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ReadWriteStringCanBeUsed",
"shortDescription": {
"text": "'Files.readString()' or 'Files.writeString()' can be used"
},
"fullDescription": {
"text": "Reports method calls that read or write a 'String' as bytes using 'java.nio.file.Files'. Such calls can be replaced with a call to a 'Files.readString()' or 'Files.writeString()' method introduced in Java 11. Example: 'String s = \"example\";\n Files.write(Paths.get(\"out.txt\"), s.getBytes(StandardCharsets.UTF_8), StandardOpenOption.WRITE);\n s = new String(Files.readAllBytes(Paths.get(\"in.txt\")), StandardCharsets.ISO_8859_1);' After the quick fix is applied: 'String s = \"example\";\n Files.writeString(Paths.get(\"out.txt\"), s, StandardOpenOption.WRITE);\n s = Files.readString(Paths.get(\"in.txt\"), StandardCharsets.ISO_8859_1);' New in 2018.3",
"markdown": "Reports method calls that read or write a `String` as bytes using `java.nio.file.Files`. Such calls can be replaced with a call to a `Files.readString()` or `Files.writeString()` method introduced in Java 11.\n\n**Example:**\n\n\n String s = \"example\";\n Files.write(Paths.get(\"out.txt\"), s.getBytes(StandardCharsets.UTF_8), StandardOpenOption.WRITE);\n s = new String(Files.readAllBytes(Paths.get(\"in.txt\")), StandardCharsets.ISO_8859_1);\n\nAfter the quick fix is applied:\n\n\n String s = \"example\";\n Files.writeString(Paths.get(\"out.txt\"), s, StandardOpenOption.WRITE);\n s = Files.readString(Paths.get(\"in.txt\"), StandardCharsets.ISO_8859_1);\n\nNew in 2018.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ReadWriteStringCanBeUsed",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 11",
"index": 174,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CyclomaticComplexity",
"shortDescription": {
"text": "Overly complex method"
},
"fullDescription": {
"text": "Reports methods that have too many branch points. A branch point is one of the following: loop statement 'if' statement ternary expression 'catch' section expression with one or more '&&' or '||' operators inside 'switch' block with non-default branches Methods with too high cyclomatic complexity may be confusing and hard to test. Use the Method complexity limit field to specify the maximum allowed cyclomatic complexity for a method.",
"markdown": "Reports methods that have too many branch points.\n\nA branch point is one of the following:\n\n* loop statement\n* `if` statement\n* ternary expression\n* `catch` section\n* expression with one or more `&&` or `||` operators inside\n* `switch` block with non-default branches\n\nMethods with too high cyclomatic complexity may be confusing and hard to test.\n\nUse the **Method complexity limit** field to specify the maximum allowed cyclomatic complexity for a method."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "OverlyComplexMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Method metrics",
"index": 132,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AwaitNotInLoop",
"shortDescription": {
"text": "'await()' not called in loop"
},
"fullDescription": {
"text": "Reports 'java.util.concurrent.locks.Condition.await()' not being called inside a loop. 'await()' and related methods are normally used to suspend a thread until some condition becomes true. As the thread could have been woken up for a different reason, the condition should be checked after the 'await()' call returns. A loop is a simple way to achieve this. Example: 'void acquire(Condition released) throws InterruptedException {\n released.await();\n }' Good code should look like this: 'void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.await();\n }\n }'",
"markdown": "Reports `java.util.concurrent.locks.Condition.await()` not being called inside a loop.\n\n\n`await()` and related methods are normally used to suspend a thread until some condition becomes true.\nAs the thread could have been woken up for a different reason,\nthe condition should be checked after the `await()` call returns.\nA loop is a simple way to achieve this.\n\n**Example:**\n\n\n void acquire(Condition released) throws InterruptedException {\n released.await();\n }\n\nGood code should look like this:\n\n\n void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.await();\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AwaitNotInLoop",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StaticVariableUninitializedUse",
"shortDescription": {
"text": "Static field used before initialization"
},
"fullDescription": {
"text": "Reports 'static' variables that are read before initialization. The inspection ignores equality checks with 'null'. Example: 'class Foo {\n public static int bar;\n\n public static void main(String[] args) {\n System.out.println(bar);\n }\n }' Note that this inspection uses a very conservative dataflow algorithm and may incorrectly report 'static' variables as uninitialized. Variables reported as initialized will always be initialized. Use the Ignore primitive fields option to ignore uninitialized primitive fields.",
"markdown": "Reports `static` variables that are read before initialization.\n\nThe inspection ignores equality checks with `null`.\n\n**Example:**\n\n\n class Foo {\n public static int bar;\n\n public static void main(String[] args) {\n System.out.println(bar);\n }\n }\n\nNote that this inspection uses a very conservative dataflow algorithm and may incorrectly report `static` variables as uninitialized. Variables\nreported as initialized will always be initialized.\n\nUse the **Ignore primitive fields** option to ignore uninitialized primitive fields."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "StaticVariableUsedBeforeInitialization",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Initialization",
"index": 33,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "CyclicClassDependency",
"shortDescription": {
"text": "Cyclic class dependency"
},
"fullDescription": {
"text": "Reports classes that are mutually or cyclically dependent on other classes. Such cyclic dependencies make code fragile and hard to maintain. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.",
"markdown": "Reports classes that are mutually or cyclically dependent on other classes.\n\nSuch cyclic dependencies make code fragile and hard to maintain.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "CyclicClassDependency",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Dependency issues",
"index": 142,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StringBufferReplaceableByStringBuilder",
"shortDescription": {
"text": "'StringBuffer' may be 'StringBuilder'"
},
"fullDescription": {
"text": "Reports variables declared as 'StringBuffer' and suggests replacing them with 'StringBuilder'. 'StringBuilder' is a non-thread-safe replacement for 'StringBuffer'. This inspection only reports if the language level of the project or module is 5 or higher.",
"markdown": "Reports variables declared as `StringBuffer` and suggests replacing them with `StringBuilder`. `StringBuilder` is a non-thread-safe replacement for `StringBuffer`.\n\nThis inspection only reports if the language level of the project or module is 5 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "StringBufferMayBeStringBuilder",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 5",
"index": 119,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SynchronizedMethod",
"shortDescription": {
"text": "'synchronized' method"
},
"fullDescription": {
"text": "Reports the 'synchronized' modifier on methods. There are several reasons a 'synchronized' modifier on a method may be a bad idea: As little work as possible should be performed under a lock. Therefore it is often better to use a 'synchronized' block and keep there only the code that works with shared state. Synchronization becomes a part of a method's interface. This makes a transition to a different locking mechanism difficult. Keeping track of what is locking a particular object gets harder. The DoS (denial-of-service) attack becomes feasible either on purpose or unknowingly when inheriting the method's class. As an alternative, consider synchronizing on a 'private final' lock object, access to which can be completely controlled. A quick-fix is provided to wrap the method body with 'synchronized(this)'. Example: 'class Main {\n public synchronized void fooBar() {\n }\n }' After the quick-fix is applied: 'class Main {\n public void fooBar() {\n synchronized (this) {\n }\n }\n }' You can configure the following options for this inspection: Include native methods - include native methods into the inspection's scope. Ignore methods overriding a synchronized method - do not report methods that override a 'synchronized' method.",
"markdown": "Reports the `synchronized` modifier on methods.\n\n\nThere are several reasons a `synchronized` modifier on a method may be a bad idea:\n\n1. As little work as possible should be performed under a lock. Therefore it is often better to use a `synchronized` block and keep there only the code that works with shared state.\n2. Synchronization becomes a part of a method's interface. This makes a transition to a different locking mechanism difficult.\n3. Keeping track of what is locking a particular object gets harder.\n4. The DoS (denial-of-service) attack becomes feasible either on purpose or unknowingly when inheriting the method's class.\n\n\nAs an alternative, consider synchronizing on a `private final` lock object, access to which can be completely controlled.\n\nA quick-fix is provided to wrap the method body with `synchronized(this)`.\n\n**Example:**\n\n\n class Main {\n public synchronized void fooBar() {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Main {\n public void fooBar() {\n synchronized (this) {\n }\n }\n }\n\nYou can configure the following options for this inspection:\n\n1. **Include native methods** - include native methods into the inspection's scope.\n2. **Ignore methods overriding a synchronized method** - do not report methods that override a `synchronized` method."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SynchronizedMethod",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AbstractMethodWithMissingImplementations",
"shortDescription": {
"text": "Abstract method with missing implementations"
},
"fullDescription": {
"text": "Reports 'abstract' methods that are not implemented in every concrete subclass. This results in a compile-time error on the subclasses; the inspection reports the problem at the point of the abstract method, allowing faster detection of the problem.",
"markdown": "Reports `abstract` methods that are not implemented in every concrete subclass.\n\n\nThis results in a compile-time error on the subclasses;\nthe inspection reports the problem at the point of the abstract method, allowing faster detection of the problem."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AbstractMethodWithMissingImplementations",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Inheritance issues",
"index": 147,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "Convert2MethodRef",
"shortDescription": {
"text": "Lambda can be replaced with method reference"
},
"fullDescription": {
"text": "Reports lambdas that can be replaced with method references. While often it could be a matter of taste, method references are more clear and readable compared to lambdas. Example: 'Runnable r = () -> System.out.println();' After the quick-fix is applied: 'Runnable r = System.out::println;' The inspection may suggest method references even if a lambda doesn't call any method, like replacing 'obj -> obj != null' with 'Objects::nonNull'. Use the Settings | Editor | Code Style | Java | Code Generation settings to configure special method references. This inspection only reports if the language level of the project or module is 8 or higher.",
"markdown": "Reports lambdas that can be replaced with method references. While often it could be a matter of taste, method references are more clear and readable compared to lambdas.\n\nExample:\n\n\n Runnable r = () -> System.out.println();\n\nAfter the quick-fix is applied:\n\n\n Runnable r = System.out::println;\n\n\nThe inspection may suggest method references even if a lambda doesn't call any method, like replacing `obj -> obj != null`\nwith `Objects::nonNull`.\nUse the [Settings \\| Editor \\| Code Style \\| Java \\| Code Generation](settings://preferences.sourceCode.Java?Lambda%20Body)\nsettings to configure special method references.\n\nThis inspection only reports if the language level of the project or module is 8 or higher."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "Convert2MethodRef",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Java language level migration aids/Java 8",
"index": 120,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SuppressionAnnotation",
"shortDescription": {
"text": "Inspection suppression annotation"
},
"fullDescription": {
"text": "Reports comments or annotations suppressing inspections. This inspection can be useful when leaving suppressions intentionally for further review. Example: '@SuppressWarnings(\"unused\")\n static Stream<String> stringProvider() {\n return Stream.of(\"foo\", \"bar\");\n }'",
"markdown": "Reports comments or annotations suppressing inspections.\n\nThis inspection can be useful when leaving suppressions intentionally for further review.\n\n**Example:**\n\n\n @SuppressWarnings(\"unused\")\n static Stream<String> stringProvider() {\n return Stream.of(\"foo\", \"bar\");\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "SuppressionAnnotation",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code maturity",
"index": 56,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryToStringCall",
"shortDescription": {
"text": "Unnecessary call to 'toString()'"
},
"fullDescription": {
"text": "Reports calls to 'toString()' that are used in the following cases: In string concatenations In the 'java.lang.StringBuilder#append()' or 'java.lang.StringBuffer#append()' methods In the methods of 'java.io.PrintWriter' or 'java.io.PrintStream' in the methods 'org.slf4j.Logger' In these cases, conversion to string will be handled by the underlying library methods, and the explicit call to 'toString()' is not needed. Example: 'System.out.println(this.toString())' After the quick-fix is applied: 'System.out.println(this)' Note that without the 'toString()' call, the code semantics might be different: if the expression is null, then the 'null' string will be used instead of throwing a 'NullPointerException'. Use the Report only when qualifier is known to be not-null option to avoid warnings for the values that could potentially be null.",
"markdown": "Reports calls to `toString()` that are used in the following cases:\n\n* In string concatenations\n* In the `java.lang.StringBuilder#append()` or `java.lang.StringBuffer#append()` methods\n* In the methods of `java.io.PrintWriter` or `java.io.PrintStream`\n* in the methods `org.slf4j.Logger`\n\nIn these cases, conversion to string will be handled by the underlying library methods, and the explicit call to `toString()` is not needed.\n\nExample:\n\n\n System.out.println(this.toString())\n\nAfter the quick-fix is applied:\n\n\n System.out.println(this)\n\n\nNote that without the `toString()` call, the code semantics might be different: if the expression is null,\nthen the `null` string will be used instead of throwing a `NullPointerException`.\n\nUse the **Report only when qualifier is known to be not-null** option to avoid warnings for the values that could potentially be null."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryToStringCall",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassOnlyUsedInOnePackage",
"shortDescription": {
"text": "Class only used from one other package"
},
"fullDescription": {
"text": "Reports classes that don't depend on any other class in their package, depend on classes from another package, and are themselves a dependency only for classes from this other package. Consider moving such classes to the package on which they depend. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.",
"markdown": "Reports classes that don't depend on any other class in their package, depend on classes from another package, and are themselves a dependency only for classes from this other package. Consider moving such classes to the package on which they depend.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassOnlyUsedInOnePackage",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Packaging issues",
"index": 44,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ReturnSeparatedFromComputation",
"shortDescription": {
"text": "'return' separated from the result computation"
},
"fullDescription": {
"text": "Reports 'return' statements that return a local variable where the value of the variable is computed somewhere else within the same method. The quick-fix inlines the returned variable by moving the return statement to the location in which the value of the variable is computed. When the returned value can't be inlined into the 'return' statement, the quick-fix attempts to move the return statement as close to the computation of the returned value as possible. Example: 'int n = -1;\n for (int i = 0; i < a.length; i++) {\n if (a[i] == b) {\n n = i;\n break;\n }\n }\n return n;' After the quick-fix is applied: 'int n = -1;\n for (int i = 0; i < a.length; i++) {\n if (a[i] == b) {\n return i;\n }\n }\n return n;'",
"markdown": "Reports `return` statements that return a local variable where the value of the variable is computed somewhere else within the same method.\n\nThe quick-fix inlines the returned variable by moving the return statement to the location in which the value\nof the variable is computed.\nWhen the returned value can't be inlined into the `return` statement,\nthe quick-fix attempts to move the return statement as close to the computation of the returned value as possible.\n\nExample:\n\n\n int n = -1;\n for (int i = 0; i < a.length; i++) {\n if (a[i] == b) {\n n = i;\n break;\n }\n }\n return n;\n\nAfter the quick-fix is applied:\n\n\n int n = -1;\n for (int i = 0; i < a.length; i++) {\n if (a[i] == b) {\n return i;\n }\n }\n return n;\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "ReturnSeparatedFromComputation",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SynchronizeOnNonFinalField",
"shortDescription": {
"text": "Synchronization on a non-final field"
},
"fullDescription": {
"text": "Reports 'synchronized' statement lock expressions that consist of a non-'final' field reference. Such statements are unlikely to have useful semantics, as different threads may acquire different locks even when operating on the same object. Example: 'private Object o;\n public void foo() {\n synchronized (o) // synchronization on a non-final field\n { }\n }'",
"markdown": "Reports `synchronized` statement lock expressions that consist of a non-`final` field reference. Such statements are unlikely to have useful semantics, as different threads may acquire different locks even when operating on the same object.\n\n**Example:**\n\n\n private Object o;\n public void foo() {\n synchronized (o) // synchronization on a non-final field\n { }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SynchronizeOnNonFinalField",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Threading issues",
"index": 29,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ArrayObjectsEquals",
"shortDescription": {
"text": "Use of shallow or 'Objects' methods with arrays"
},
"fullDescription": {
"text": "Reports expressions that seem to use an inappropriate method for determining array equality or calculating their hashcode. The following method calls are reported: 'Object.equals()' for any arrays 'Arrays.equals()' for multidimensional arrays 'Arrays.hashCode()' for multidimensional arrays",
"markdown": "Reports expressions that seem to use an inappropriate method for determining array equality or calculating their hashcode.\n\nThe following method calls are reported:\n\n* `Object.equals()` for any arrays\n* `Arrays.equals()` for multidimensional arrays\n* `Arrays.hashCode()` for multidimensional arrays"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ArrayObjectsEquals",
"cweIds": [
480
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JUnit5Converter",
"shortDescription": {
"text": "JUnit 4 test can be JUnit 5"
},
"fullDescription": {
"text": "Reports JUnit 4 tests that can be automatically migrated to JUnit 5. While default runners are automatically convertible, custom runners, method- and field- rules are not and require manual changes. Example: 'import org.junit.Assert;\n import org.junit.Test;\n\n public class RelevantTest {\n @Test\n public void testIt() {\n Assert.assertEquals(\"expected\", \"actual\");\n }\n }' After the quick-fix is applied: 'import org.junit.jupiter.api.Assertions;\n import org.junit.jupiter.api.Test;\n\n public class RelevantTest {\n @Test\n public void testIt() {\n Assertions.assertEquals(\"expected\", \"actual\");\n }\n }' This inspection requires that the JUnit 5 library is available in the classpath, and JDK 1.8 or later is configured for the project.",
"markdown": "Reports JUnit 4 tests that can be automatically migrated to JUnit 5. While default runners are automatically convertible, custom runners, method- and field- rules are not and require manual changes.\n\n**Example:**\n\n\n import org.junit.Assert;\n import org.junit.Test;\n\n public class RelevantTest {\n @Test\n public void testIt() {\n Assert.assertEquals(\"expected\", \"actual\");\n }\n }\n\nAfter the quick-fix is applied:\n\n\n import org.junit.jupiter.api.Assertions;\n import org.junit.jupiter.api.Test;\n\n public class RelevantTest {\n @Test\n public void testIt() {\n Assertions.assertEquals(\"expected\", \"actual\");\n }\n }\n\nThis inspection requires that the JUnit 5 library is available in the classpath, and JDK 1.8 or later is configured for the project."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "JUnit5Converter",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Test frameworks",
"index": 121,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "EqualsWhichDoesntCheckParameterClass",
"shortDescription": {
"text": "'equals()' method which does not check class of parameter"
},
"fullDescription": {
"text": "Reports 'equals()' methods that do not check the type of their parameter. Failure to check the type of the parameter in the 'equals()' method may result in latent errors if the object is used in an untyped collection. Example: 'class MyClass {\n int x;\n\n @Override\n public boolean equals(Object obj) {\n // equals method should return false if obj is not MyClass\n return ((MyClass)obj).x == x;\n }\n }'",
"markdown": "Reports `equals()` methods that do not check the type of their parameter.\n\nFailure to check the type of the parameter\nin the `equals()` method may result in latent errors if the object is used in an untyped collection.\n\n**Example:**\n\n\n class MyClass {\n int x;\n\n @Override\n public boolean equals(Object obj) {\n // equals method should return false if obj is not MyClass\n return ((MyClass)obj).x == x;\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "EqualsWhichDoesntCheckParameterClass",
"cweIds": [
697
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AssignmentToSuperclassField",
"shortDescription": {
"text": "Constructor assigns value to field defined in superclass"
},
"fullDescription": {
"text": "Reports assignment to, or modification of fields that are declared in a superclass from within a subclass constructor. It is considered preferable to initialize the fields of a superclass in its own constructor and delegate to that constructor in a subclass. This will also allow declaring a field 'final' if it isn't changed after the construction. Example: 'class Super {\n int x;\n }\n class Sub extends Super {\n Sub(int _x) {\n // Warning: x is declared in a superclass\n x = _x;\n }\n }' To avoid the problem, declare a superclass constructor: 'class Super {\n final int x;\n\n Super(int _x) {\n x = _x;\n }\n }\n class Sub extends Super {\n Sub(int _x) {\n super(_x);\n }\n }'",
"markdown": "Reports assignment to, or modification of fields that are declared in a superclass from within a subclass constructor.\n\nIt is considered preferable to initialize the fields of a superclass in its own constructor and\ndelegate to that constructor in a subclass. This will also allow declaring a field `final`\nif it isn't changed after the construction.\n\n**Example:**\n\n\n class Super {\n int x;\n }\n class Sub extends Super {\n Sub(int _x) {\n // Warning: x is declared in a superclass\n x = _x;\n }\n }\n\nTo avoid the problem, declare a superclass constructor:\n\n\n class Super {\n final int x;\n\n Super(int _x) {\n x = _x;\n }\n }\n class Sub extends Super {\n Sub(int _x) {\n super(_x);\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "AssignmentToSuperclassField",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Assignment issues",
"index": 87,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "NumericOverflow",
"shortDescription": {
"text": "Numeric overflow"
},
"fullDescription": {
"text": "Reports expressions that overflow during computation. Usually, this happens by accident and indicates a bug. For example, a wrong type is used or a shift should be done in an opposite direction . Examples: 'float a = 1.0f/0.0f;\n long b = 30 * 24 * 60 * 60 * 1000;\n long c = 1000L << 62;'",
"markdown": "Reports expressions that overflow during computation. Usually, this happens by accident and indicates a bug. For example, a wrong type is used or a shift should be done in an opposite direction .\n\n**Examples:**\n\n\n float a = 1.0f/0.0f;\n long b = 30 * 24 * 60 * 60 * 1000;\n long c = 1000L << 62;\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "NumericOverflow",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Numeric issues",
"index": 31,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SuspiciousIndentAfterControlStatement",
"shortDescription": {
"text": "Suspicious indentation after control statement without braces"
},
"fullDescription": {
"text": "Reports suspicious indentation of statements after a control statement without braces. Such indentation can make it look like the statement is inside the control statement, when in fact it will be executed unconditionally after the control statement. Example: 'class Bar {\n void foo(int i) {\n if (i == 0)\n System.out.println(\"foo\");\n System.out.println(\"bar\"); // warning\n if (i == 1);\n System.out.println(\"great\"); // warning\n if (i == 42)\n System.out.println(\"answer\");\n System.out.println(\"question\"); // warning\n }\n }'",
"markdown": "Reports suspicious indentation of statements after a control statement without braces.\n\n\nSuch indentation can make it look like the statement is inside the control statement,\nwhen in fact it will be executed unconditionally after the control statement.\n\n**Example:**\n\n\n class Bar {\n void foo(int i) {\n if (i == 0)\n System.out.println(\"foo\");\n System.out.println(\"bar\"); // warning\n if (i == 1);\n System.out.println(\"great\"); // warning\n if (i == 42)\n System.out.println(\"answer\");\n System.out.println(\"question\"); // warning\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "SuspiciousIndentAfterControlStatement",
"cweIds": [
483
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassNewInstance",
"shortDescription": {
"text": "Unsafe call to 'Class.newInstance()'"
},
"fullDescription": {
"text": "Reports calls to 'java.lang.Class.newInstance()'. This method propagates exceptions thrown by the no-arguments constructor, including checked exceptions. Usages of this method effectively bypass the compile-time exception checking that would otherwise be performed by the compiler. A quick-fix is suggested to replace the call with a call to the 'java.lang.reflect.Constructor.newInstance()' method, which avoids this problem by wrapping any exception thrown by the constructor in a (checked) 'java.lang.reflect.InvocationTargetException'. Example: 'clazz.newInstance()' After the quick-fix is applied: 'clazz.getConstructor().newInstance();'",
"markdown": "Reports calls to `java.lang.Class.newInstance()`.\n\n\nThis method propagates exceptions thrown by\nthe no-arguments constructor, including checked exceptions. Usages of this method\neffectively bypass the compile-time exception checking that would\notherwise be performed by the compiler.\n\n\nA quick-fix is suggested to replace the call with a call to the\n`java.lang.reflect.Constructor.newInstance()` method, which\navoids this problem by wrapping any exception thrown by the constructor in a\n(checked) `java.lang.reflect.InvocationTargetException`.\n\n**Example:**\n\n\n clazz.newInstance()\n\nAfter the quick-fix is applied:\n\n\n clazz.getConstructor().newInstance();\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassNewInstance",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "LimitedScopeInnerClass",
"shortDescription": {
"text": "Local class"
},
"fullDescription": {
"text": "Reports local classes. A local class is a named nested class declared inside a code block. Local classes are uncommon and may therefore be confusing. In addition, some code standards discourage the use of local classes. Example: 'void test() {\n class Local { // local class\n }\n new Local();\n }'",
"markdown": "Reports local classes.\n\nA local class is a named nested class declared inside a code block.\nLocal classes are uncommon and may therefore be confusing.\nIn addition, some code standards discourage the use of local classes.\n\n**Example:**\n\n\n void test() {\n class Local { // local class\n }\n new Local();\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "LimitedScopeInnerClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MultiplyOrDivideByPowerOfTwo",
"shortDescription": {
"text": "Multiplication or division by power of two"
},
"fullDescription": {
"text": "Reports multiplication of an integer value by a constant integer that can be represented as a power of two. Such expressions can be replaced with right or left shift operations for a possible performance improvement. Note that this inspection is not relevant for modern JVMs (e. g., HotSpot or OpenJ9) because their JIT compilers will perform this optimization. It might only be useful in some embedded systems where no JIT compilation is performed. Example: 'int y = x * 4;' A quick-fix is suggested to replace the multiplication or division operation with the shift operation: 'int y = x << 2;' Use the option to make the inspection also report division by a power of two. Note that replacing a power of two division with a shift does not work for negative numbers.",
"markdown": "Reports multiplication of an integer value by a constant integer that can be represented as a power of two. Such expressions can be replaced with right or left shift operations for a possible performance improvement.\n\n\nNote that this inspection is not relevant for modern JVMs (e. g.,\nHotSpot or OpenJ9) because their JIT compilers will perform this optimization.\nIt might only be useful in some embedded systems where no JIT compilation is performed.\n\n**Example:**\n\n\n int y = x * 4;\n\nA quick-fix is suggested to replace the multiplication or division operation with the shift operation:\n\n\n int y = x << 2;\n\n\nUse the option to make the inspection also report division by a power of two.\nNote that replacing a power of two division with a shift does not work for negative numbers."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "MultiplyOrDivideByPowerOfTwo",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance/Embedded",
"index": 167,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MethodCallInLoopCondition",
"shortDescription": {
"text": "Method call in loop condition"
},
"fullDescription": {
"text": "Reports method calls in the condition part of a loop statement. In highly resource constrained environments, such calls may have adverse performance implications. Applying the results of this inspection without consideration might have negative effects on code clarity and design. This inspection is intended for Java ME and other highly resource constrained environments. Example: 'String s = \"example\";\n for (int i = 0; i < s.length(); i++) {\n System.out.println(s.charAt(i));\n }' After the quick-fix is applied: 'String s = \"example\";\n int length = s.length();\n for (int i = 0; i < length; i++) {\n System.out.println(s.charAt(i));\n }' Use the option to ignore calls to common Java iteration methods like 'Iterator.hasNext()' and known methods with side-effects like 'Atomic*.compareAndSet'.",
"markdown": "Reports method calls in the condition part of a loop statement. In highly resource constrained environments, such calls may have adverse performance implications.\n\n\nApplying the results of this inspection without consideration might have negative effects on code clarity and design.\nThis inspection is intended for Java ME and other highly resource constrained environments.\n\n**Example:**\n\n\n String s = \"example\";\n for (int i = 0; i < s.length(); i++) {\n System.out.println(s.charAt(i));\n }\n\nAfter the quick-fix is applied:\n\n\n String s = \"example\";\n int length = s.length();\n for (int i = 0; i < length; i++) {\n System.out.println(s.charAt(i));\n }\n\n\nUse the option to ignore calls to common Java iteration methods like `Iterator.hasNext()`\nand known methods with side-effects like `Atomic*.compareAndSet`."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "MethodCallInLoopCondition",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance/Embedded",
"index": 167,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ForLoopReplaceableByWhile",
"shortDescription": {
"text": "'for' loop may be replaced by 'while' loop"
},
"fullDescription": {
"text": "Reports 'for' loops that contain neither initialization nor update components, and suggests converting them to 'while' loops. This makes the code easier to read. Example: 'for(; exitCondition(); ) {\n process();\n }' After the quick-fix is applied: 'while(exitCondition()) {\n process();\n }' The quick-fix is also available for other 'for' loops, so you can replace any 'for' loop with a 'while' loop. Use the Ignore 'infinite' for loops without conditions option if you want to ignore 'for' loops with trivial or non-existent conditions.",
"markdown": "Reports `for` loops that contain neither initialization nor update components, and suggests converting them to `while` loops. This makes the code easier to read.\n\nExample:\n\n\n for(; exitCondition(); ) {\n process();\n }\n\nAfter the quick-fix is applied:\n\n\n while(exitCondition()) {\n process();\n }\n\nThe quick-fix is also available for other `for` loops, so you can replace any `for` loop with a\n`while` loop.\n\nUse the **Ignore 'infinite' for loops without conditions** option if you want to ignore `for`\nloops with trivial or non-existent conditions."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ForLoopReplaceableByWhile",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "MethodCount",
"shortDescription": {
"text": "Class with too many methods"
},
"fullDescription": {
"text": "Reports classes whose number of methods exceeds the specified maximum. Classes with too many methods are often trying to 'do too much'. Consider splitting such a class into multiple smaller classes. Configure the inspection: Use the Method count limit field to specify the maximum allowed number of methods in a class. Use the Ignore simple getter and setter methods option to ignore simple getters and setters in method count. Use the Ignore methods overriding/implementing a super method to ignore methods that override or implement a method from a superclass.",
"markdown": "Reports classes whose number of methods exceeds the specified maximum.\n\nClasses with too many methods are often trying to 'do too much'. Consider splitting such a class into multiple smaller classes.\n\nConfigure the inspection:\n\n* Use the **Method count limit** field to specify the maximum allowed number of methods in a class.\n* Use the **Ignore simple getter and setter methods** option to ignore simple getters and setters in method count.\n* Use the **Ignore methods overriding/implementing a super method** to ignore methods that override or implement a method from a superclass."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ClassWithTooManyMethods",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Class metrics",
"index": 123,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StaticFieldReferenceOnSubclass",
"shortDescription": {
"text": "Static field referenced via subclass"
},
"fullDescription": {
"text": "Reports accesses to static fields where the call is qualified by a subclass of the declaring class, rather than by the declaring class itself. Java allows such qualification, but such accesses may indicate a subtle confusion of inheritance and overriding. Example: 'class Parent {\n static int foo = 0;\n }\n\n class Child extends Parent { }\n\n void bar() {\n System.out.println(Child.foo);\n }' After the quick-fix is applied, the result looks like this: 'class Parent {\n static int foo = 0;\n }\n\n class Child extends Parent { }\n\n void bar() {\n System.out.println(Parent.foo);\n }'",
"markdown": "Reports accesses to static fields where the call is qualified by a subclass of the declaring class, rather than by the declaring class itself.\n\n\nJava allows such qualification, but such accesses may indicate a subtle confusion of inheritance and overriding.\n\n**Example:**\n\n\n class Parent {\n static int foo = 0;\n }\n\n class Child extends Parent { }\n\n void bar() {\n System.out.println(Child.foo);\n }\n\nAfter the quick-fix is applied, the result looks like this:\n\n\n class Parent {\n static int foo = 0;\n }\n\n class Child extends Parent { }\n\n void bar() {\n System.out.println(Parent.foo);\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "StaticFieldReferencedViaSubclass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "IgnoredJUnitTest",
"shortDescription": {
"text": "JUnit test annotated with '@Ignore'/'@Disabled'"
},
"fullDescription": {
"text": "Reports usages of JUnit 4's '@Ignore' or JUnit 5's '@Disabled' annotations. It is considered a code smell to have tests annotated with these annotations for a long time, especially when no reason is specified. Example: '@Ignore\n public class UrgentTest {\n\n @Test\n public void testIt() {\n Assert.assertEquals(\"expected\", \"actual\");\n }\n }' Configure the inspection: Use the Only report annotations without reason option to only report the cases when no reason is specified as the annotation's 'value' attribute.",
"markdown": "Reports usages of JUnit 4's `@Ignore` or JUnit 5's `@Disabled` annotations. It is considered a code smell to have tests annotated with these annotations for a long time, especially when no reason is specified.\n\n**Example:**\n\n\n @Ignore\n public class UrgentTest {\n\n @Test\n public void testIt() {\n Assert.assertEquals(\"expected\", \"actual\");\n }\n }\n\n\nConfigure the inspection:\n\n* Use the **Only report annotations without reason** option to only report the cases when no reason is specified as the annotation's `value` attribute."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "IgnoredJUnitTest",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Test frameworks",
"index": 121,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "BlockingMethodInNonBlockingContext",
"shortDescription": {
"text": "Possibly blocking call in non-blocking context"
},
"fullDescription": {
"text": "Reports thread-blocking method calls in code fragments where threads should not be blocked. Example (Project Reactor): 'Flux.just(\"1\").flatMap(f -> {\n Flux<String> just = loadUsersFromDatabase();\n just.toIterable(); // Error: blocking operator call in non-blocking scope\n return just;\n }\n);' Consider running blocking code with a proper scheduler, for example 'Schedulers.boundedElastic()', or try to find an alternative non-blocking API. Example (Kotlin Coroutines): 'suspend fun exampleFun() {\n Thread.sleep(100); // Error: blocking method call inside suspend function\n}' Consider running blocking code with a special dispatcher, for example 'Dispatchers.IO', or try to find an alternative non-blocking API. Configure the inspection: In the Blocking Annotations list, specify annotations that mark thread-blocking methods. In the Non-Blocking Annotations list, specify annotations that mark non-blocking methods. Specified annotations can be used as External Annotations",
"markdown": "Reports thread-blocking method calls in code fragments where threads should not be blocked.\n\n**Example (Project Reactor):**\n\n\n Flux.just(\"1\").flatMap(f -> {\n Flux<String> just = loadUsersFromDatabase();\n just.toIterable(); // Error: blocking operator call in non-blocking scope\n return just;\n }\n );\n\nConsider running blocking code [with a proper\nscheduler](https://projectreactor.io/docs/core/release/reference/#faq.wrap-blocking), for example `Schedulers.boundedElastic()`, or try to find an alternative non-blocking API.\n\n**Example (Kotlin Coroutines):**\n\n\n suspend fun exampleFun() {\n Thread.sleep(100); // Error: blocking method call inside suspend function\n }\n\nConsider running blocking code [with a special dispatcher](https://kotlinlang.org/docs/coroutine-context-and-dispatchers.html),\nfor example `Dispatchers.IO`, or try to find an alternative non-blocking API.\n\nConfigure the inspection:\n\n* In the **Blocking Annotations** list, specify annotations that mark thread-blocking methods.\n* In the **Non-Blocking Annotations** list, specify annotations that mark non-blocking methods.\n\nSpecified annotations can be used as [External Annotations](https://www.jetbrains.com/help/idea/external-annotations.html)"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "BlockingMethodInNonBlockingContext",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages",
"index": 1,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "IgnoreResultOfCall",
"shortDescription": {
"text": "Result of method call ignored"
},
"fullDescription": {
"text": "Reports method calls whose result is ignored. For many methods, ignoring the result is perfectly legitimate, but for some it is almost certainly an error. Examples of methods where ignoring the result is likely an error include 'java.io.inputStream.read()', which returns the number of bytes actually read, and any method on 'java.lang.String' or 'java.math.BigInteger'. These methods do not produce side-effects and thus pointless if their result is ignored. The calls to the following methods are inspected: Simple getters (which do nothing except return a field) Methods specified in the settings of this inspection Methods annotated with 'org.jetbrains.annotations.Contract(pure=true)' Methods annotated with .*.'CheckReturnValue' Methods in a class or package annotated with 'javax.annotation.CheckReturnValue' Optionally, all non-library methods Calls to methods annotated with Error Prone's or AssertJ's '@CanIgnoreReturnValue' annotation are not reported. Use the inspection settings to specify the classes to check. Methods are matched by name or name pattern using Java regular expression syntax. For classes, use fully-qualified names. Each entry applies to both the class and all its inheritors.",
"markdown": "Reports method calls whose result is ignored.\n\nFor many methods, ignoring the result is perfectly\nlegitimate, but for some it is almost certainly an error. Examples of methods where ignoring\nthe result is likely an error include `java.io.inputStream.read()`,\nwhich returns the number of bytes actually read, and any method on\n`java.lang.String` or `java.math.BigInteger`. These methods do not produce side-effects and thus pointless\nif their result is ignored.\n\nThe calls to the following methods are inspected:\n\n* Simple getters (which do nothing except return a field)\n* Methods specified in the settings of this inspection\n* Methods annotated with `org.jetbrains.annotations.Contract(pure=true)`\n* Methods annotated with .\\*.`CheckReturnValue`\n* Methods in a class or package annotated with `javax.annotation.CheckReturnValue`\n* Optionally, all non-library methods\n\nCalls to methods annotated with Error Prone's or AssertJ's `@CanIgnoreReturnValue` annotation are not reported.\n\n\nUse the inspection settings to specify the classes to check.\nMethods are matched by name or name pattern using Java regular expression syntax.\nFor classes, use fully-qualified names. Each entry applies to both the class and all its inheritors."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ResultOfMethodCallIgnored",
"cweIds": [
252,
563
],
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "AssertBetweenInconvertibleTypes",
"shortDescription": {
"text": "'assertEquals()' between objects of inconvertible types"
},
"fullDescription": {
"text": "Reports calls to assertion methods where the \"expected\" and \"actual\" arguments are of incompatible types. Such calls often indicate that there is a bug in the test. This inspection checks the relevant JUnit, TestNG, and AssertJ methods. Examples: 'assertEquals(\"1\", 1);\n assertNotSame(new int[0], 0);\n\n // weak warning, may just test the equals() contract\n assertThat(foo).as(\"user type\").isNotEqualTo(bar);'",
"markdown": "Reports calls to assertion methods where the \"expected\" and \"actual\" arguments are of incompatible types.\n\nSuch calls often indicate that there is a bug in the test.\nThis inspection checks the relevant JUnit, TestNG, and AssertJ methods.\n\n**Examples:**\n\n\n assertEquals(\"1\", 1);\n assertNotSame(new int[0], 0);\n\n // weak warning, may just test the equals() contract\n assertThat(foo).as(\"user type\").isNotEqualTo(bar);\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "AssertBetweenInconvertibleTypes",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "JVM languages/Test frameworks",
"index": 121,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "SwitchExpressionCanBePushedDown",
"shortDescription": {
"text": "Common subexpression can be extracted from 'switch'"
},
"fullDescription": {
"text": "Reports switch expressions and statements where every branch has a common subexpression, and the 'switch' can be moved inside. This action shortens the code. In many cases, it's reasonable to extract the resulting switch expression to a separate variable or method. Example: 'switch (value) {\n case 0 -> System.out.println(\"zero\");\n case 1 -> System.out.println(\"one\");\n case 2, 3, 4 -> System.out.println(\"few\");\n default -> System.out.println(\"many\");\n }' After the quick-fix is applied: 'System.out.println(switch (value) {\n case 0 -> \"zero\";\n case 1 -> \"one\";\n case 2, 3, 4 -> \"few\";\n default -> \"many\";\n });' This inspection is applicable only for enhanced switches with arrow syntax. New in 2022.3",
"markdown": "Reports switch expressions and statements where every branch has a common subexpression, and the `switch` can be moved inside. This action shortens the code. In many cases, it's reasonable to extract the resulting switch expression to a separate variable or method.\n\nExample:\n\n\n switch (value) {\n case 0 -> System.out.println(\"zero\");\n case 1 -> System.out.println(\"one\");\n case 2, 3, 4 -> System.out.println(\"few\");\n default -> System.out.println(\"many\");\n }\n\nAfter the quick-fix is applied:\n\n\n System.out.println(switch (value) {\n case 0 -> \"zero\";\n case 1 -> \"one\";\n case 2, 3, 4 -> \"few\";\n default -> \"many\";\n });\n\n\nThis inspection is applicable only for enhanced switches with arrow syntax.\n\nNew in 2022.3"
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "SwitchExpressionCanBePushedDown",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "InnerClassReferencedViaSubclass",
"shortDescription": {
"text": "Inner class referenced via subclass"
},
"fullDescription": {
"text": "Reports accesses of inner and nested classes where the call is qualified by a subclass of the declaring class, rather than the declaring class itself. Java allows such qualification, but such accesses may indicate a subtle confusion of inheritance and overriding. Example: 'class Super {\n static class Inner {}\n }\n\n class Sub extends Super {\n void test() {\n Sub.Inner s = new Sub.Inner(); // 'Inner' class is declared in 'Super' class, but referenced via 'Sub' class\n }\n }' After the quick-fix is applied: 'class Super {\n static class Inner {}\n }\n\n class Sub extends Super {\n void test() {\n Super.Inner s = new Super.Inner();\n }\n }'",
"markdown": "Reports accesses of inner and nested classes where the call is qualified by a subclass of the declaring class, rather than the declaring class itself.\n\n\nJava allows such qualification, but such accesses may indicate a subtle confusion of inheritance and overriding.\n\n**Example:**\n\n\n class Super {\n static class Inner {}\n }\n\n class Sub extends Super {\n void test() {\n Sub.Inner s = new Sub.Inner(); // 'Inner' class is declared in 'Super' class, but referenced via 'Sub' class\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Super {\n static class Inner {}\n }\n\n class Sub extends Super {\n void test() {\n Super.Inner s = new Super.Inner();\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "InnerClassReferencedViaSubclass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ConfusingElse",
"shortDescription": {
"text": "Redundant 'else'"
},
"fullDescription": {
"text": "Reports redundant 'else' keywords in 'if'—'else' statements and statement chains. The 'else' keyword is redundant when all previous branches end with a 'return', 'throw', 'break', or 'continue' statement. In this case, the statements from the 'else' branch can be placed after the 'if' statement, and the 'else' keyword can be removed. Example: 'if (name == null) {\n throw new IllegalArgumentException();\n } else {\n System.out.println(name);\n }' After the quick-fix is applied: 'if (name == null) {\n throw new IllegalArgumentException();\n }\n System.out.println(name);' Disable the Report when there are no more statements after the 'if' statement option to ignore cases where the 'if'—'else' statement is the last statement in a code block.",
"markdown": "Reports redundant `else` keywords in `if`---`else` statements and statement chains.\n\n\nThe `else` keyword is redundant when all previous branches end with a\n`return`, `throw`, `break`, or `continue` statement. In this case,\nthe statements from the `else` branch can be placed after the `if` statement, and the\n`else` keyword can be removed.\n\n**Example:**\n\n\n if (name == null) {\n throw new IllegalArgumentException();\n } else {\n System.out.println(name);\n }\n\nAfter the quick-fix is applied:\n\n\n if (name == null) {\n throw new IllegalArgumentException();\n }\n System.out.println(name);\n\nDisable the **Report when there are no more statements after the 'if' statement** option to ignore cases where the `if`---`else` statement is the last statement in a code block."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "ConfusingElseBranch",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ChannelResource",
"shortDescription": {
"text": "'Channel' opened but not safely closed"
},
"fullDescription": {
"text": "Reports 'Channel' resources that are not safely closed, including any instances created by calling 'getChannel()' on a file or socket resource. By default, the inspection assumes that the resources can be closed by any method with 'close' or 'cleanup' in its name. Example: 'void send(Socket socket) throws IOException {\n SocketChannel channel = socket.getChannel(); //warning\n channel.write(ByteBuffer.wrap(\"message\".getBytes()));\n }' Use the following options to configure the inspection: Whether a 'Channel' resource is allowed to be opened inside a 'try' block. This style is less desirable because it is more verbose than opening a 'Channel' in front of a 'try' block. Whether the resource can be closed by any method call with the resource passed as argument.",
"markdown": "Reports `Channel` resources that are not safely closed, including any instances created by calling `getChannel()` on a file or socket resource.\n\n\nBy default, the inspection assumes that the resources can be closed by any method with\n'close' or 'cleanup' in its name.\n\n**Example:**\n\n\n void send(Socket socket) throws IOException {\n SocketChannel channel = socket.getChannel(); //warning\n channel.write(ByteBuffer.wrap(\"message\".getBytes()));\n }\n\n\nUse the following options to configure the inspection:\n\n* Whether a `Channel` resource is allowed to be opened inside a `try` block. This style is less desirable because it is more verbose than opening a `Channel` in front of a `try` block.\n* Whether the resource can be closed by any method call with the resource passed as argument."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ChannelOpenedButNotSafelyClosed",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Resource management",
"index": 133,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ScheduledThreadPoolExecutorWithZeroCoreThreads",
"shortDescription": {
"text": "'ScheduledThreadPoolExecutor' with zero core threads"
},
"fullDescription": {
"text": "Reports any 'java.util.concurrent.ScheduledThreadPoolExecutor' instances in which 'corePoolSize' is set to zero via the 'setCorePoolSize' method or the object constructor. A 'ScheduledThreadPoolExecutor' with zero core threads will run nothing. Example: 'void foo(int corePoolSize) {\n if (corePoolSize != 0) return;\n ThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(corePoolSize); // warning\n executor.setCorePoolSize(corePoolSize); // warning\n }'",
"markdown": "Reports any `java.util.concurrent.ScheduledThreadPoolExecutor` instances in which `corePoolSize` is set to zero via the `setCorePoolSize` method or the object constructor.\n\n\nA `ScheduledThreadPoolExecutor` with zero core threads will run nothing.\n\n**Example:**\n\n\n void foo(int corePoolSize) {\n if (corePoolSize != 0) return;\n ThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(corePoolSize); // warning\n executor.setCorePoolSize(corePoolSize); // warning\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "ScheduledThreadPoolExecutorWithZeroCoreThreads",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ClassMayBeInterface",
"shortDescription": {
"text": "Abstract 'class' may be 'interface'"
},
"fullDescription": {
"text": "Reports 'abstract' classes that can be converted to interfaces. Using interfaces instead of classes is preferable as Java doesn't support multiple class inheritance, while a class can implement multiple interfaces. A class may be converted to an interface if it has no superclasses (other than Object), has only 'public static final' fields, 'public abstract' methods, and 'public' inner classes. Example: 'abstract class Example {\n public static final int MY_CONST = 42;\n public abstract void foo();\n}\n\nclass Inheritor extends Example {\n @Override\n public void foo() {\n System.out.println(MY_CONST);\n }\n}' After the quick-fix is applied: 'interface Example {\n int MY_CONST = 42;\n void foo();\n}\n\nclass Inheritor implements Example {\n @Override\n public void foo() {\n System.out.println(MY_CONST);\n }\n}' Configure the inspection: Use the Report classes containing non-abstract methods when using Java 8 option to report only the classes with 'static' methods and non-abstract methods that can be converted to 'default' methods (only applicable to language level of 8 or higher).",
"markdown": "Reports `abstract` classes that can be converted to interfaces.\n\nUsing interfaces instead of classes is preferable as Java doesn't support multiple class inheritance,\nwhile a class can implement multiple interfaces.\n\nA class may be converted to an interface if it has no superclasses (other\nthan Object), has only `public static final` fields,\n`public abstract` methods, and `public` inner classes.\n\n\nExample:\n\n\n abstract class Example {\n public static final int MY_CONST = 42;\n public abstract void foo();\n }\n\n class Inheritor extends Example {\n @Override\n public void foo() {\n System.out.println(MY_CONST);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n interface Example {\n int MY_CONST = 42;\n void foo();\n }\n\n class Inheritor implements Example {\n @Override\n public void foo() {\n System.out.println(MY_CONST);\n }\n }\n\nConfigure the inspection:\n\n\nUse the **Report classes containing non-abstract methods when using Java 8** option to report only the classes with `static` methods and non-abstract methods that can be converted to\n`default` methods (only applicable to language level of 8 or higher)."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "ClassMayBeInterface",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Class structure",
"index": 21,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessaryCallToStringValueOf",
"shortDescription": {
"text": "Unnecessary conversion to 'String'"
},
"fullDescription": {
"text": "Reports unnecessary calls to static methods that convert their parameters to a string, e.g. 'String.valueOf()' or 'Integer.toString()'. Such calls are unnecessary when used in string concatenations. Example: 'System.out.println(\"Number: \" + Integer.toString(count));' After the quick-fix is applied: 'System.out.println(\"Number: \" + count);' Additionally such calls are unnecessary when used as arguments to library methods that do their own string conversion. Some examples of library methods that do their own string conversion are: Classes 'java.io.PrintWriter', 'java.io.PrintStream' 'print()', 'println()' Classes 'java.lang.StringBuilder', 'java.lang.StringBuffer' 'append()' Class 'org.slf4j.Logger' 'trace()', 'debug()', 'info()', 'warn()', 'error()' Use the Report calls that can be replaced with a concatenation with the empty string option to also report cases where concatenations with the empty string can be used instead of a call to 'String.valueOf()'.",
"markdown": "Reports unnecessary calls to static methods that convert their parameters to a string, e.g. `String.valueOf()` or `Integer.toString()`. Such calls are unnecessary when used in string concatenations.\n\nExample:\n\n\n System.out.println(\"Number: \" + Integer.toString(count));\n\nAfter the quick-fix is applied:\n\n\n System.out.println(\"Number: \" + count);\n\nAdditionally such calls are unnecessary when used as arguments to library methods that do their own string conversion. Some examples of library methods that do their own string conversion are:\n\n* Classes `java.io.PrintWriter`, `java.io.PrintStream`\n * `print()`, `println()`\n* Classes `java.lang.StringBuilder`, `java.lang.StringBuffer`\n * `append()`\n* Class `org.slf4j.Logger`\n * `trace()`, `debug()`, `info()`, `warn()`, `error()`\n\n\nUse the **Report calls that can be replaced with a concatenation with the empty string**\noption to also report cases where concatenations with the empty string can be used instead of a call to `String.valueOf()`."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessaryCallToStringValueOf",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "StringReplaceableByStringBuffer",
"shortDescription": {
"text": "Non-constant 'String' can be replaced with 'StringBuilder'"
},
"fullDescription": {
"text": "Reports variables declared as 'java.lang.String' that are repeatedly appended to. Such variables could be declared more efficiently as 'java.lang.StringBuffer' or 'java.lang.StringBuilder'. Example: 'String s = \"\";\n for (int i = 0; i < names.length; i++) {\n String name = names[i] + (i == names.length - 1 ? \"\" : \" \");\n s = s + name;\n }' Such a loop can be replaced with: 'StringBuilder s = new StringBuilder();\n for (int i = 0; i < names.length; i++) {\n String name = names[i] + (i == names.length - 1 ? \"\" : \" \");\n s.append(name);\n }' Or even with: 'String s = String.join(\" \", names);' Use the option to make this inspection only report when the variable is appended to in a loop.",
"markdown": "Reports variables declared as `java.lang.String` that are repeatedly appended to. Such variables could be declared more efficiently as `java.lang.StringBuffer` or `java.lang.StringBuilder`.\n\n**Example:**\n\n\n String s = \"\";\n for (int i = 0; i < names.length; i++) {\n String name = names[i] + (i == names.length - 1 ? \"\" : \" \");\n s = s + name;\n }\n\nSuch a loop can be replaced with:\n\n\n StringBuilder s = new StringBuilder();\n for (int i = 0; i < names.length; i++) {\n String name = names[i] + (i == names.length - 1 ? \"\" : \" \");\n s.append(name);\n }\n\nOr even with:\n\n\n String s = String.join(\" \", names);\n\n\nUse the option to make this inspection only report when the variable is appended to in a loop."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "NonConstantStringShouldBeStringBuffer",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Performance",
"index": 10,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "FinallyBlockCannotCompleteNormally",
"shortDescription": {
"text": "'finally' block which can not complete normally"
},
"fullDescription": {
"text": "Reports 'return', 'throw', 'break', 'continue', and 'yield' statements that are used inside 'finally' blocks. These cause the 'finally' block to not complete normally but to complete abruptly. Any exceptions thrown from the 'try' and 'catch' blocks of the same 'try'-'catch' statement will be suppressed. Example: 'void x() {\n try {\n throw new RuntimeException();\n } finally {\n // if bar() returns true, the RuntimeException will be suppressed\n if (bar()) return;\n }\n }'",
"markdown": "Reports `return`, `throw`, `break`, `continue`, and `yield` statements that are used inside `finally` blocks. These cause the `finally` block to not complete normally but to complete abruptly. Any exceptions thrown from the `try` and `catch` blocks of the same `try`-`catch` statement will be suppressed.\n\n**Example:**\n\n\n void x() {\n try {\n throw new RuntimeException();\n } finally {\n // if bar() returns true, the RuntimeException will be suppressed\n if (bar()) return;\n }\n }\n"
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "finally",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Error handling",
"index": 14,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ConstantOnWrongSideOfComparison",
"shortDescription": {
"text": "Constant on wrong side of comparison"
},
"fullDescription": {
"text": "Reports comparison operations where the constant value is on the wrong side. Some coding conventions specify that constants should be on a specific side of a comparison, either left or right. Example: 'boolean compare(int x) {\n return 1 > x; // Constant '1' on the left side of the comparison\n }' After the quick-fix is applied: 'boolean compare(int x) {\n return x < 1;\n }' Use the inspection settings to choose the side of constants in comparisons and whether to warn if 'null' literals are on the wrong side. New in 2019.2",
"markdown": "Reports comparison operations where the constant value is on the wrong side.\n\nSome coding conventions specify that constants should be on a specific side of a comparison, either left or right.\n\n**Example:**\n\n\n boolean compare(int x) {\n return 1 > x; // Constant '1' on the left side of the comparison\n }\n\nAfter the quick-fix is applied:\n\n\n boolean compare(int x) {\n return x < 1;\n }\n\n\nUse the inspection settings to choose the side of constants in comparisons\nand whether to warn if `null` literals are on the wrong side.\n\nNew in 2019.2"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ConstantOnWrongSideOfComparison",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UnnecessarilyQualifiedStaticallyImportedElement",
"shortDescription": {
"text": "Unnecessarily qualified statically imported element"
},
"fullDescription": {
"text": "Reports usage of statically imported members qualified with their containing class name. Such qualification is unnecessary and can be removed because statically imported members can be accessed directly by member name. Example: 'import static foo.Test.WIDTH;\n\n class Bar {\n void bar() {\n System.out.println(Test.WIDTH);\n }\n }' After the quick-fix is applied: 'import static foo.Test.WIDTH;\n\n class Bar {\n void bar() {\n System.out.println(WIDTH);\n }\n }'",
"markdown": "Reports usage of statically imported members qualified with their containing class name.\n\nSuch qualification is unnecessary and can be removed\nbecause statically imported members can be accessed directly by member name.\n\n**Example:**\n\n\n import static foo.Test.WIDTH;\n\n class Bar {\n void bar() {\n System.out.println(Test.WIDTH);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n import static foo.Test.WIDTH;\n\n class Bar {\n void bar() {\n System.out.println(WIDTH);\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UnnecessarilyQualifiedStaticallyImportedElement",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Code style issues",
"index": 11,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "ObjectToString",
"shortDescription": {
"text": "Call to default 'toString()'"
},
"fullDescription": {
"text": "Reports calls to 'toString()' that use the default implementation from 'java.lang.Object'. The default implementation is rarely intended but may be used by accident. Calls to 'toString()' on objects with 'java.lang.Object', interface or abstract class type are ignored by this inspection. Example: 'class Bar {\n void foo1(Bar bar) {\n String s = bar.toString(); // warning\n /* ... */\n }\n\n void foo2(Object obj) {\n String s = obj.toString(); // no warning here\n /* ... */\n }\n }'",
"markdown": "Reports calls to `toString()` that use the default implementation from `java.lang.Object`.\n\nThe default implementation is rarely intended but may be used by accident.\n\n\nCalls to `toString()` on objects with `java.lang.Object`,\ninterface or abstract class type are ignored by this inspection.\n\n**Example:**\n\n\n class Bar {\n void foo1(Bar bar) {\n String s = bar.toString(); // warning\n /* ... */\n }\n\n void foo2(Object obj) {\n String s = obj.toString(); // no warning here\n /* ... */\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "ObjectToString",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Probable bugs",
"index": 15,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "UseOfJDBCDriverClass",
"shortDescription": {
"text": "Use of concrete JDBC driver class"
},
"fullDescription": {
"text": "Reports uses of specific JDBC driver classes. Use of such classes will bind your project to a specific database and driver, defeating the purpose of JDBC and resulting in loss of portability. Example: 'import java.sql.Driver;\n\n abstract class Sample implements Driver {\n public void foo() {\n Sample sample;\n }\n }'",
"markdown": "Reports uses of specific JDBC driver classes. Use of such classes will bind your project to a specific database and driver, defeating the purpose of JDBC and resulting in loss of portability.\n\n**Example:**\n\n\n import java.sql.Driver;\n\n abstract class Sample implements Driver {\n public void foo() {\n Sample sample;\n }\n }\n"
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "UseOfJDBCDriverClass",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Portability",
"index": 95,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JDBCResource",
"shortDescription": {
"text": "JDBC resource opened but not safely closed"
},
"fullDescription": {
"text": "Reports JDBC resources that are not safely closed. JDBC resources reported by this inspection include 'java.sql.Connection', 'java.sql.Statement', 'java.sql.PreparedStatement', 'java.sql.CallableStatement', and 'java.sql.ResultSet'. By default, the inspection assumes that the resources can be closed by any method with 'close' or 'cleanup' in its name. Example: 'ResultSet findAllElements(Connection connection) throws SQLException {\n PreparedStatement statement = connection.prepareStatement(\"SELECT * FROM TABLE\");//statement is not closed\n statement.execute();\n return statement.getResultSet();\n }' Use the following options to configure the inspection: Whether a JDBC resource is allowed to be opened inside a 'try' block. This style is less desirable because it is more verbose than opening a resource in front of a 'try' block. Whether the resource can be closed by any method call with the resource passed as argument.",
"markdown": "Reports JDBC resources that are not safely closed. JDBC resources reported by this inspection include `java.sql.Connection`, `java.sql.Statement`, `java.sql.PreparedStatement`, `java.sql.CallableStatement`, and `java.sql.ResultSet`.\n\n\nBy default, the inspection assumes that the resources can be closed by any method with\n'close' or 'cleanup' in its name.\n\n**Example:**\n\n\n ResultSet findAllElements(Connection connection) throws SQLException {\n PreparedStatement statement = connection.prepareStatement(\"SELECT * FROM TABLE\");//statement is not closed\n statement.execute();\n return statement.getResultSet();\n }\n\n\nUse the following options to configure the inspection:\n\n* Whether a JDBC resource is allowed to be opened inside a `try` block. This style is less desirable because it is more verbose than opening a resource in front of a `try` block.\n* Whether the resource can be closed by any method call with the resource passed as argument."
},
"defaultConfiguration": {
"enabled": false,
"level": "warning",
"parameters": {
"suppressToolId": "JDBCResourceOpenedButNotSafelyClosed",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{
"target": {
"id": "Java/Resource management",
"index": 133,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "IfCanBeAssertion",
"shortDescription": {
"text": "Statement can be replaced with 'assert' or 'Objects.requireNonNull'"
},
"fullDescription": {
"text": "Reports 'if' statements that throw only 'java.lang.Throwable' from a 'then' branch and do not have an 'else' branch. Such statements can be converted to more compact 'assert' statements. The inspection also reports Guava's 'Preconditions.checkNotNull()'. They can be replaced with a 'Objects.requireNonNull()' call for which a library may not be needed. Example: 'if (x == 2) throw new RuntimeException(\"fail\");\n if (y == null) throw new AssertionError();\n Preconditions.checkNotNull(z, \"z\");' After the quick-fix is applied: 'assert x != 2 : \"fail\";\n Objects.requireNonNull(y);\n Objects.requireNonNull(z, \"z\");' By default, this inspection provides a quick-fix in the editor without code highlighting.",
"markdown": "Reports `if` statements that throw only `java.lang.Throwable` from a `then` branch and do not have an `else` branch. Such statements can be converted to more compact `assert` statements.\n\n\nThe inspection also reports Guava's `Preconditions.checkNotNull()`.\nThey can be replaced with a `Objects.requireNonNull()` call for which a library may not be needed.\n\nExample:\n\n\n if (x == 2) throw new RuntimeException(\"fail\");\n if (y == null) throw new AssertionError();\n Preconditions.checkNotNull(z, \"z\");\n\nAfter the quick-fix is applied:\n\n\n assert x != 2 : \"fail\";\n Objects.requireNonNull(y);\n Objects.requireNonNull(z, \"z\");\n\nBy default, this inspection provides a quick-fix in the editor without code highlighting."
},
"defaultConfiguration": {
"enabled": true,
"level": "note",
"parameters": {
"suppressToolId": "IfCanBeAssertion",
"ideaSeverity": "INFORMATION",
"qodanaSeverity": "Info"
}
},
"relationships": [
{
"target": {
"id": "Java/Control flow issues",
"index": 30,
"toolComponent": {
"name": "QDJVM"
}
},
"kinds": [
"superset"
]
}
]
},
{
"id": "JavadocDeclaration",
"shortDescription": {
"text": "Javadoc declaration problems"
},
"fullDescription": {
"text": "Reports Javadoc comments and tags with the following problems: invalid tag names incomplete tag descriptions duplicated tags missing Javadoc descriptions Example: '/**\n * Invalid tag name\n * @poram param description\n */\n public void sample(int param){\n }' Example: '/**\n * Pointing to itself {@link #sample(int)}\n */\n public void sample(int param){\n }' Quick-fix adds the unknown Javadoc tag to the list of user defined additional tags. Use textfield below to define additional Javadoc tags. Use first checkbox to ignore duplicated 'throws' tag. Use second checkbox to ignore problem with missing or incomplete first sentence in the description. Use third checkbox to ignore references pointing to itself.",
"markdown": "Reports Javadoc comments and tags with the following problems:\n\n* invalid tag names\n* incomplete tag descriptions\n* duplicated tags\n* missing Javadoc descriptions\n\nExample:\n\n\n /**\n * Invalid tag name\n * @poram param description\n */\n public void sample(int param){\n }\n\nExample:\n\n\n /**\n * Pointing to itself {@link #sample(int)}\n */\n public void sample(int param){\n }\n\nQuick-fix adds the unknown Javadoc tag to the list of user defined additional tags.\n\nUse textfield below to define additional Javadoc tags.\n\nUse first checkbox to ignore duplicated 'throws' tag.\n\nUse second checkbox to ignore problem with missing or incomplete first sentence in the description.\n\nUse third checkbox to ignore references pointing to itself."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"suppressToolId": "JavadocDeclaration",
"ideaSeverity": "WARNING",
"qodanaSeverity": "High"
}
},
"relationships": [
{